-
-
Notifications
You must be signed in to change notification settings - Fork 670
Cached methods with do_pickle=True for UniqueRepresentation #40874
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: develop
Are you sure you want to change the base?
Cached methods with do_pickle=True for UniqueRepresentation #40874
Conversation
Documentation preview for this PR (built with commit b0261ca; changes) is ready! 🎉 |
About this comment: #28096 (comment) I think that there is no side effect except negligible increase of pickle size (due to added empty dict) for unique representation objects. |
Thanks for getting this ready! This fixes a very subtle bug so I want to test locally (which will take a bit longer). I'll try to get to this in the next week or so. I'm guessing from the |
I'm going to test this anyway, but I assume this doesn't change the ability to load in pickles from before this change? |
I don't know. We need to test. |
From the next week or so, I am out of town for a week or two. So take your time. |
I tested. It is backward compatible. On the develop branch: sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
sage: I = sage.rings.ideal.Katsura(P,3)
sage: I.groebner_basis() # @cached_method(do_pickle=True)
[a - 60*c^3 + 158/7*c^2 + 8/7*c - 1,
b + 30*c^3 - 79/7*c^2 + 3/7*c,
c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
sage: I.save('test1')
sage: UCF = UniversalCyclotomicField() # UniqueRepresentation
sage: UCF.zero() # @cached_method
0
sage: UCF.save('test2') Then on the PR branch: sage: Ip = load('test1')
sage: Ip.groebner_basis.cache
{(('', None, None, False),
()): [a - 60*c^3 + 158/7*c^2 + 8/7*c - 1,
b + 30*c^3 - 79/7*c^2 + 3/7*c,
c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]}
sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
sage: I = sage.rings.ideal.Katsura(P,3)
sage: I.groebner_basis.cache
{}
sage: Ip is I
False
sage: Ip == I
True
sage: UCFp = load('test2')
sage: UCF = UniversalCyclotomicField()
sage: UCFp is UCF
True
sage: UCFp.zero.cache
sage: UCFp.zero()
0
sage: UCFp.zero.cache
0 By the way, I could not find a class with |
fixes #28096.
The doctest failure https://github.com/sagemath/sage/actions/runs/17940271644/job/51014975901?pr=40874 is not related with this PR branch.
What the PR branch does is explained clearly in #28096 (comment)
📝 Checklist
⌛ Dependencies