Skip to content
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

Sets poly ring caching to false for modules #3872

Merged
merged 7 commits into from
Jul 19, 2024

Conversation

ederc
Copy link
Member

@ederc ederc commented Jun 19, 2024

See #2455.

Again, some tests are failing due to different parent rings, thus I would like @jankoboehm and @HechtiDerLachs to have a look.

@ederc ederc marked this pull request as draft June 19, 2024 07:48
@HechtiDerLachs
Copy link
Collaborator

HechtiDerLachs commented Jul 1, 2024

I think this should fix the tests.

But we should discuss whether or not we really want this behavior. Maybe it's reasonable to cache the ring for the Hilbert series of all modules in the base_ring so that we do not get different parents for different modules over the same ring? But this is just a suggestion. I do not have a strong personal opinion on this.

@wdecker , @jankoboehm .

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.07%. Comparing base (edb44e2) to head (4d0e278).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3872      +/-   ##
==========================================
+ Coverage   84.05%   84.07%   +0.02%     
==========================================
  Files         592      592              
  Lines       81746    81757      +11     
==========================================
+ Hits        68708    68738      +30     
+ Misses      13038    13019      -19     
Files Coverage Δ
src/Rings/mpoly-graded.jl 91.36% <ø> (ø)
src/Modules/hilbert.jl 81.94% <89.47%> (+1.64%) ⬆️

... and 5 files with indirect coverage changes

@ederc
Copy link
Member Author

ederc commented Jul 1, 2024

Thanks for fixing.

@HechtiDerLachs
Copy link
Collaborator

HechtiDerLachs commented Jul 1, 2024

The last commit is a suggestion for how we can regain usability after briefly consulting with @wdecker . Let me know, everyone, in case there is further need for discussion.

CC: @JohnAAbbott

@fieker
Copy link
Contributor

fieker commented Jul 1, 2024 via email

function hilbert_series_parent(S::MPolyDecRing)
if !isdefined(S, :hilbert_series_parent)
if is_z_graded(S)
S.hilbert_series_parent = laurent_polynomial_ring(ZZ, :t; cached=false)[1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about always using a multivariate polynomial ring?

Suggested change
S.hilbert_series_parent = laurent_polynomial_ring(ZZ, :t; cached=false)[1]
S.hilbert_series_parent = laurent_polynomial_ring(ZZ, [:t]; cached=false)[1]

That would make the return value of this function potentially type stable (well, with some further changes). As @jankoboehm says "this might also help with some other issues". But of course it might also cause issues... So this is really an open question.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless people come up with qualified opinions on this, I will leave it as is since these were the rings used in the source code up to this point for the different cases.

Type stability did not seem to matter before. If it matters now, I need clear advice which ring to use.

src/Modules/hilbert.jl Outdated Show resolved Hide resolved
src/Modules/hilbert.jl Outdated Show resolved Hide resolved
@joschmitt joschmitt removed the triage label Jul 4, 2024
@joschmitt
Copy link
Member

Doctests fail?

@lgoettgens
Copy link
Member

Evaluated output:
│ 
│ (-t^2 + 1)^1*(-t^4 + 1)^1*(-t^3 + 1)^1
│ 
│ Expected output:
│ 
│ (-t^4 + 1)^1*(-t^3 + 1)^1*(-t^2 + 1)^1

to my eyes, these look identical

@ederc
Copy link
Member Author

ederc commented Jul 4, 2024

Yes, but I do not completely understand why the order of the terms change when not caching the rings when computing the hilbert series.

@ederc ederc marked this pull request as ready for review July 4, 2024 12:00
@JohnAAbbott
Copy link
Contributor

Maybe the order of the terms/factors was never deterministic, and just by chance we see it now? It may be coincidence that it arises after changing the caching?

@joschmitt
Copy link
Member

Somebody put effort in it that the denominator is printed in this factorized form. I agree that it is mathematically equivalent, but whoever made this printing might have an opinion on the order of exponents as well.

@fieker
Copy link
Contributor

fieker commented Jul 4, 2024 via email

@joschmitt
Copy link
Member

It appears that the doc test fails because previously multi_hilbert_series would return elements of a multivariate Laurent polynomial ring (which might actually only have one variable). This ring is created with _hilbert_series_ring which is now partially duplicated by the new hilbert_series_parent.

@joschmitt
Copy link
Member

I pushed a commit so that different parents are used for hilbert_series and multi_hilbert_series. This should also restore type stability.

@ederc
Copy link
Member Author

ederc commented Jul 11, 2024

@joschmitt Thanks, looks good to me.

@HechtiDerLachs
Copy link
Collaborator

This also looks like a reasonable solution to me. Thanks @joschmitt . Maybe @JohnAAbbott can have a look and confirm that everything is alright with his part of the code on Hilbert series?

Copy link
Contributor

@JohnAAbbott JohnAAbbott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me -- but is the type specification on line 126 of src/Modules/hilbert.jl correct? Can it not be simply parent::Ring = ...?

@joschmitt
Copy link
Member

The changes look good to me -- but is the type specification on line 126 of src/Modules/hilbert.jl correct? Can it not be simply parent::Ring = ...?

Thank you, you are right! I corrected it.

Copy link
Member

@joschmitt joschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by @JohnAAbbott (and also the triage meeting last week).

@joschmitt joschmitt enabled auto-merge (squash) July 19, 2024 14:45
@joschmitt joschmitt merged commit a8d2911 into oscar-system:master Jul 19, 2024
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants