Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here comes a more opinionated change where some input could be helpful.
This change originates from a problem I have, but it doesn't solve the problem. The problem is that I want
ArbSeries
(andAcbSeries
) to satisfy the invariancesAt the moment this doesn't work because the type
ArbSeries
doesn't contain any information about the degree of the series. The only way I see to solve this issue is to parameterize theArbSeries
type on the degree, so it would becomeArbSeries{N}
whereN
is the degree. However, I'm afraid that would be too costly in terms of compilation since all methods would have to be compiled separately for each degree.This PR doesn't solve the above problem, but moves one step towards some sort of solution. It changes the Series types so that the polynomial is stored separately from the degree. For methods that don't need the degree, but only act on the underlying polynomial, it is then possible to pass them just the polynomial. If we ever decide to parameterize the type (I'm not sure we'll) this would at least allow for having less of the code needing compilation based on the degree.
More precisely the PR changes the layout of the struct for
ArbSeries
andAcbSeries
, forArbSeries
it changes fromto
It makes it possible to, given an
ArbSeries
, treat it as anArbPoly
for some computations, without having to allocate. At the moment there is no non-allocating constructor forArbSeries
, this could possibly be added in the future.I can also note that I don't think there is any performance penalty for this change. The struct is immutable so everything seems to be stored inline anyway.