-
Notifications
You must be signed in to change notification settings - Fork 73
Add many @req !is_trivial checks
#1857
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -445,6 +445,7 @@ to the constructor with the same base ring $R$ and element $a$. A modulus | |||||||||
| of zero is not supported and throws an exception. | ||||||||||
| """ | ||||||||||
| function residue_ring(R::Ring, a::RingElement; cached::Bool = true) | ||||||||||
| @req !is_trivial(R) "Zero rings are currently not supported as base ring." | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
Then again: if
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep the error as provided by the PR for now (with the "currently"). I think the line below with the reference to the C library is a bit misleading, as it is not relevant. |
||||||||||
| # Modulus of zero cannot be supported. E.g. A C library could not be expected to | ||||||||||
| # do matrices over Z/0 using a Z/nZ type. The former is multiprecision, the latter not. | ||||||||||
|
Comment on lines
449
to
450
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| iszero(a) && throw(DomainError(a, "Modulus must be nonzero")) | ||||||||||
|
|
@@ -454,6 +455,7 @@ function residue_ring(R::Ring, a::RingElement; cached::Bool = true) | |||||||||
| end | ||||||||||
|
|
||||||||||
| function residue_ring(R::PolyRing, a::RingElement; cached::Bool = true) | ||||||||||
| @req !is_trivial(R) "Zero rings are currently not supported as base ring." | ||||||||||
| iszero(a) && throw(DomainError(a, "Modulus must be nonzero")) | ||||||||||
| !is_unit(leading_coefficient(a)) && throw(DomainError(a, "Non-invertible leading coefficient")) | ||||||||||
| T = elem_type(R) | ||||||||||
|
|
||||||||||
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.
This of course conflicts with PR #1729 (no biggie, just want to make it explicit -- we'll have to plan in time to adjust depending on the order we merge these in)