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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change
similar
,zero_matrix
,ones_matrix
to useUndefInitializer
constructors #1909base: master
Are you sure you want to change the base?
Change
similar
,zero_matrix
,ones_matrix
to useUndefInitializer
constructors #1909Changes from 4 commits
ffa3842
1a3012f
fa96542
75919c0
b767716
f7d1dbf
6392a3c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. This will allow some code deduplication in Nemo, where something like this is currently implemented for every Matrix type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, not quite: there we often will want to omit the
zero!
because the "undef" matrices are actually already zero initialized. E.g. forZZMatrix
.So they'd still have to have a method like
or maybe rather
However this made me realize a problem: we don't require the
UndefInitializer
constructors to perform a sanity check onr
andc
(i.e. that they are>= 0
). And we probably don't want to (it is not needed when called fromsimilar
).So this method here should actually have such a check. But that's fine. And then we'd keep the existing
zero_matrix
method forZZRing
as it is. However, we could most or all of these methods from `fmpz_mat.jl:Well maybe the last one should be kept as it is a very minor optimization (as it avoids allocating to "convert"
d
to aZZRingElem
if it is a bit integer). Though as I said, very few people would go through that interface anyway, so maybe nothing to worry about too much...