-
-
Couldn't load subscription status.
- Fork 683
moving fraction_field method to categories #40213
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?
Conversation
|
Documentation preview for this PR (built with commit 8ade692; changes) is ready! 🎉 |
e471125 to
ab119ab
Compare
| def ngens(self): | ||
| r""" | ||
| Return the number of generators of ``self``. | ||
| This is always 1. | ||
| EXAMPLES:: | ||
| sage: L = LazyDirichletSeriesRing(ZZ, 'z') | ||
| sage: L.ngens() | ||
| 1 | ||
| """ | ||
| return 1 | ||
|
|
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.
Not sure whether this is a good idea - I don't think the Dirichlet series ring is finitely generated.
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.
Well, no, but you have one generator t somewhere in the code..
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.
Actually, we don't. There is a data structure, which we carefully hide - the _internal_poly_ring.
Why is adding ngens necessary or useful? Maybe it helps me to understand or we find a better solution.
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.
Well, I am currently investigating the other failures.
I had to do that change in Lazy Dirichlet for their fraction field to work.
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.
Here is the failure without my fix
File "src/sage/rings/lazy_series_ring.py", line 3916, in sage.rings.lazy_series_ring.LazyDirichletSeriesRing.__init__
Failed example:
TestSuite(L).run() # needs sage.symbolic
Expected nothing
Got:
Failure in _test_fraction_field:
Traceback (most recent call last):
File "sage/structure/category_object.pyx", line 857, in sage.structure.category_object.CategoryObject.getattr_from_category
return self._cached_methods[name]
KeyError: 'ngens'
<BLANKLINE>
During handling of the above exception, another exception occurred:
<BLANKLINE>
Traceback (most recent call last):
File "/home/chapoton/sage/src/sage/misc/sage_unittest.py", line 298, in run
test_method(tester=tester)
File "/home/chapoton/sage/src/sage/categories/integral_domains.py", line 203, in _test_fraction_field
fraction_field = self.fraction_field()
^^^^^^^^^^^^^^^^^^^^^
File "sage/misc/cachefunc.pyx", line 2333, in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__
self.cache = f(self._instance)
File "/home/chapoton/sage/src/sage/categories/integral_domains.py", line 191, in fraction_field
return sage.rings.fraction_field.FractionField_generic(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/chapoton/sage/src/sage/rings/fraction_field.py", line 205, in __init__
Parent.__init__(self, base=R, names=R._names, category=cat)
File "sage/structure/parent.pyx", line 301, in sage.structure.parent.Parent.__init__
self._assign_names(names, normalize)
File "sage/structure/parent_gens.pyx", line 152, in sage.structure.parent_gens.ParentWithGens._assign_names
names = category_object.normalize_names(self.ngens(), names)
File "/home/chapoton/sage/src/sage/rings/fraction_field.py", line 937, in ngens
return self._R.ngens()
^^^^^^^^^^^^^
File "sage/structure/category_object.pyx", line 851, in sage.structure.category_object.CategoryObject.__getattr__
return self.getattr_from_category(name)
File "sage/structure/category_object.pyx", line 866, in sage.structure.category_object.CategoryObject.getattr_from_category
attr = getattr_from_other_class(self, cls, name)
File "sage/cpython/getattr.pyx", line 358, in sage.cpython.getattr.getattr_from_other_class
raise AttributeError(dummy_error_message)
AttributeError: 'LazyDirichletSeriesRing_with_category' object has no attribute 'ngens'
------------------------------------------------------------
The following tests failed: _test_fraction_field
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 know under which assumptions FractionField_generic is supposed to work?
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.
Here is something that causes problems :
sage: L = LazyDirichletSeriesRing(ZZ,'z')
sage: L._names
('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.
Sorry, I don't understand. Why is this causing problems?
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.
Well, this name is transmitted to the fraction field, which then tries to call "ngens", which forces us to add the silly "ngens" method
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.
So I think for the moment, the simplest way out is just to add the silly method "ngens". I have more difficult issues to fix, in particular something about src/sage/algebras/splitting_algebra.py
| sage: Sym1 = SymmetricFunctions(FiniteField(23)) | ||
| sage: Sym2 = SymmetricFunctions(Integers(23)) | ||
| sage: TestSuite(Sym).run() | ||
| sage: TestSuite(Sym).run(skip="_test_fraction_field") |
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.
Sym has a (very naive) implementation of a fraction field, which is actually used (in the lazy code). I missed what's going wrong, sorry.
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.
fractions field of realizations are working fine. What is not working is the interplay between the Sym without realization and the fraction field tests.
1a9e1ef to
b5f125b
Compare
|
undoign the changes in src/sage/rings/polynomial/polynomial_quotient_ring.py fixes the current failurs, but trigger new failures in padics. |
sagemathgh-40749: small cleanup of the file splitting_algebra.py in preparation for sagemath#40213 ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. URL: sagemath#40749 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
|
could you convert this to draft until it is ready for review? |
|
Voila. Help welcome, this is a difficult one. |
|
I would like to help, but I don't know how. I figured that, which eventually calls whereas the new code which does something different: |
|
yes, this is a tough case. At this point, I am wondering if one should implement |
I think the issue is due to the test case. It cannot be verified by code that The warning that should be suppressed by Therefore, it is the user's responsibility to check whether My suggestion is to add or this one: BTW: The warning message above is broken. It won't appear if you remove |
|
what about the failures in cubic Hecke algebras ? any suggestions ?
|
These failures are caused by the custom method The simplest, but symptomatic, solution would be to simply add the Therefore, I suggest either adding an |
out of the "ring.pyx" file and into the appropriate categories
On the way, one has to fix a few triggered issues. There remain several ones.
📝 Checklist