-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add many @req !is_trivial
checks
#1857
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 | ||||
---|---|---|---|---|---|---|
|
@@ -823,6 +823,7 @@ that it will always be returned by a call to the constructor when the same | |||||
base ring $R$ is supplied. | ||||||
""" | ||||||
function fraction_field(R::Ring; cached::Bool=true) | ||||||
@req !is_trivial(R) "Zero rings are currently not supported as coefficient ring." | ||||||
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
|
||||||
return Generic.fraction_field(R; cached=cached) | ||||||
end | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -450,6 +450,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." | ||||||||||
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 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. | ||||||||||
iszero(a) && throw(DomainError(a, "Modulus must be nonzero")) | ||||||||||
|
@@ -459,6 +460,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) | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -490,6 +490,7 @@ residue ring parent object is cached and returned for any subsequent calls | |
to the constructor with the same base ring $R$ and element $a$. | ||
""" | ||
function residue_field(R::Ring, a::RingElement; cached::Bool = true) | ||
@req !is_trivial(R) "Zero rings are currently not supported as base ring." | ||
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 think here, too, we could remove the "currently", as any quotient of a zero ring can't be a field. |
||
iszero(a) && throw(DivideError()) | ||
T = elem_type(R) | ||
S = EuclideanRingResidueField{T}(R(a), cached) | ||
|
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.
Can a zero ring have a fraction field at all? What would that be?
So maybe the "currently" can be removed here?
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.
I think the zero ring satisfies the universal property of being a fraction field of the zero ring.Edit: What I wrote is only correct if you don't insist on the fraction field being a field.Edit edit: I guess the answer is no. What I wrote makes sense for the "total field of fractions", but not for fraction fields.