-
Notifications
You must be signed in to change notification settings - Fork 124
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
pretty printing for quotients, graded and localized multivariate polynomial rings #2184
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2184 +/- ##
==========================================
- Coverage 71.93% 0.00% -71.94%
==========================================
Files 391 347 -44
Lines 52657 48392 -4265
==========================================
- Hits 37879 0 -37879
- Misses 14778 48392 +33614
|
src/Rings/MPolyQuo.jl
Outdated
println(io, "Quotient") | ||
println(io, " of ", base_ring(Q)) | ||
print(io, " by Ideal with " , ngens(modulus(Q)), "generators") |
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.
The key information of the quotient ring is the base_ring and the modulus.
I agree that in standard view only the number of generators is printed, but there should be an even more detailed view available, which prints the modulus (and not in supercompact printing of an ideal). Think of a user having defined several quotients of the same base_ring and trying to pick the right one for the next computation.
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.
Some more information on the modulus is probably desirable in standard view.
There will be no more detailed view than standard view. In this case you have to ask the quotient ring for the information that you desire.
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.
Indeed, this also solves the dilemma of how much information is necessary.
src/Rings/localization_interface.jl
Outdated
function Base.show(io::IO, W::AbsLocalizedRing) | ||
io = pretty(io) | ||
if get(io, :supercompact, false) | ||
print(io, "Localized ring") | ||
else | ||
print(io, "Localization of ", Lowercase(), base_ring(W)) | ||
print(pretty(IOContext(io, :supercompact =>true)), " at ", Lowercase(), inverted_set(W)) | ||
end |
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.
@thofma this is it.
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.
A part from a few things, looks good from a technical point of view.
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 went through all the output and wrote at least one comment for each of the small nitpicks I have. Overall there are the following central points:
- better pretty printing mult. set inverting powers of elements
- something changed in try - catch doctests -- is this intentional
- some supercompact suggestions
x -> [1] | ||
y -> [2] | ||
z -> [3], MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) | ||
(Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y, z]) |
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.
minor nitpick: printing of the variables still needs improvement
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.
how?
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.
'... over QQ, variables [x,y,z]'
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.
What we print here is a tuple (Ring, Vector{Variables})
because the constructor also returns the variables.
Arrays always print their type. Since we do not own arrays (they come from Base
), we cannot change this.
And it might not be a good idea even if we could.
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 see.
What struck me, was the enormous disbalance between the amount of detail printed for the first entry (nice and suitable for mathematicians) and the second entry (which easily takes more than a line before even opening the square bracket, if you are dealing with a graded ring over an algebraic extension of QQ).
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.
Something very similar has been discussed in #2064, although without a result.
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.
For (multivarite) rings a solution would be to return the generators as a tuple and not as an array. The tuple does not print its 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.
.... but this is not type stable, so we are back to arrays.
@@ -404,11 +404,11 @@ Spec of Multivariate polynomial ring in 3 variables over QQ | |||
|
|||
===================================== | |||
Affine charts of the blown up scheme: | |||
Spec of Localization of Quotient of Multivariate polynomial ring in 3 variables over QQ by ideal(0, 0, 0) at the multiplicative set powers of QQMPolyRingElem[1] | |||
Spec of Localization of quotient of multivariate polynomial ring at multiplicative subset |
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 would suggest to be a bit more precise with the multiplicative set here, if this is not compact/supercompact: '... ring by inverting powers of an element' and suppress the multiplicative set completely in more compact printing. If we localize, we do it at a mult. closed subset, so the current information is redundant.
@@ -39,7 +39,7 @@ julia> I = ideal(R, [x]); | |||
julia> U = complement_of_prime_ideal(I); | |||
|
|||
julia> Spec(R, U) | |||
Spec of localization of Multivariate polynomial ring in 2 variables over QQ at the complement of ideal(x) | |||
Spec of Localization of multivariate polynomial ring in 2 variables over QQ at Complement of prime ideal |
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.
Do you really want this in capital letters? (Localization, Complement)
x -> [1] | ||
y -> [1] | ||
z -> [1], MPolyDecRingElem{MPolyQuoRingElem{QQMPolyRingElem}, AbstractAlgebra.Generic.MPoly{MPolyQuoRingElem{QQMPolyRingElem}}}[x, y, z]) | ||
(Graded multivariate polynomial ring in 3 variables over Quotient of multivariate polynomial ring, MPolyDecRingElem{MPolyQuoRingElem{QQMPolyRingElem}, AbstractAlgebra.Generic.MPoly{MPolyQuoRingElem{QQMPolyRingElem}}}[x, y, z]) |
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.
minor nitpick: second and third argument still need pretty printing.
src/Rings/PBWAlgebra.jl
Outdated
@@ -1306,7 +1306,7 @@ julia> I = left_ideal(A, [p, q]) | |||
left_ideal(p, q) | |||
|
|||
julia> try eliminate(I, [q]); catch e; e; end # in fact, no elimination ordering exists | |||
ErrorException("could not find elimination ordering") | |||
|
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.
see above.
src/Rings/mpoly-localizations.jl
Outdated
print(io, "powers of ") | ||
print(io, denominators(S)) | ||
io = pretty(io) | ||
if get(io, :supercompact, false) |
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.
In supercompact, either print nothing at all or something stating that we are dealing with powers/products of elements.
The 'multiplicative set' should be left for multiple localizations, where we see more general multiplicative sets (unless we simplify them, which is not even on our agenda...)
76f659f
to
d3684de
Compare
src/Rings/mpoly-localizations.jl
Outdated
julia> PSI = hom(TL, RQL, RQL.([x])) | ||
Ring homomorphism | ||
from localization of multivariate polynomial ring in 1 variable over QQ at complement of maximal ideal | ||
to Localization of quotient of multivariate polynomial ring at complement of maximal ideal |
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.
@thofma the Localization
should be lowercase ?
src/Rings/mpoly-localizations.jl
Outdated
from Localization of quotient of multivariate polynomial ring at complement of maximal ideal | ||
to localization of multivariate polynomial ring in 1 variable over QQ at complement of maximal ideal |
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.
for MPolyQuo the localizations start with a capital letter, for MPolyRing with a lowercase letter. Probably there is still a typo in the MPolyQuo-case somewhere.
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.
there is still something fishy in our printing system. @thofma is investigating
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.
Looks good to me.
Remember to change the respective testset in mpoly-localizations.jl to agree with the new output format.
I removed these old tests and added some doctests instead. |
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.
Now this is a clear approval.
Sideremark: Finding and solving the 'something fishy' in the printing system is related to this PR, but not part of the changes.
This pr should probably wait until the changes from nemo and abstract algebra propagate.