Opened 12 years ago
Closed 12 years ago
#4322 closed defect (fixed)
[with patch, with positive review] modular polynomials database is broken
Reported by: | AlexGhitza | Owned by: | mabshoff |
---|---|---|---|
Priority: | major | Milestone: | sage-3.3 |
Component: | packages: optional | Keywords: | modular polynomial database |
Cc: | robertwb | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
In 3.1.4, install this optional spkg with
sage -i database_kohel-20060803
then
sage: DBMP = ClassicalModularPolynomialDatabase() sage: DBMP[29] <string>:1: Warning: 'with' will become a reserved keyword in Python 2.6 ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (1683, 0)) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /opt/sage-3.1.4/devel/sage-main/sage/structure/<ipython console> in <module>() /opt/sage-3.1.4/local/lib/python2.5/site-packages/sage/databases/db_modular_polynomials.pyc in __getitem__(self, level) 93 for cff in coeff_list: 94 poly[(cff[0],cff[1])] = Integer(cff[2]) ---> 95 return P(polydict.PolyDict(poly)) 96 97 class ModularCorrespondenceDatabase(ModularPolynomialDatabase): /opt/sage-3.1.4/local/lib/python2.5/site-packages/sage/rings/polynomial/multi_polynomial_libsingular.so in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular.__call__ (sage/rings/polynomial/multi_polynomial_libsingular.cpp:6996)() /opt/sage-3.1.4/local/lib/python2.5/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:3732)() 303 del self._convert_from_list[i] 304 break --> 305 raise 306 307 raise TypeError, "No conversion defined from %s to %s"%(R, self) /opt/sage-3.1.4/local/lib/python2.5/site-packages/sage/structure/parent.so in sage.structure.parent.__call__ (sage/structure/parent.c:3619)() 294 try: 295 if no_extra_args: --> 296 return mor._call_(x) 297 else: 298 return mor._call_with_args(x, args, kwds) /opt/sage-3.1.4/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:2622)() 74 print type(self._codomain), self._codomain 75 print type(self._codomain._element_constructor), self._codomain._element_constructor ---> 76 raise 77 78 cpdef Element _call_with_args(self, x, args=(), kwds={}): /opt/sage-3.1.4/local/lib/python2.5/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps._call_ (sage/structure/coerce_maps.c:2537)() 69 cpdef Element _call_(self, x): 70 try: ---> 71 return self._codomain._element_constructor(x) 72 except: 73 if print_warnings: /opt/sage-3.1.4/local/lib/python2.5/site-packages/sage/rings/integer.so in sage.rings.integer.Integer.__init__ (sage/rings/integer.c:5688)() TypeError: unable to coerce <type 'sage.rings.polynomial.polydict.PolyDict'> to an integer
Attachments (1)
Change History (7)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
- Cc robertwb added
- Component changed from optional packages to coercion
- Owner changed from mabshoff to robertwb
RobertWB is the man here :)
Cheers,
Michael
comment:3 Changed 12 years ago by
- Component changed from coercion to optional packages
- Owner changed from robertwb to mabshoff
Actually, it looks like it's due to #4021, MPolynomial_libsingular over ZZ. It still works in the generic case:
sage: P.<x,y> = ZZ['t']['x,y'] sage: a = sage.rings.polynomial.polydict.PolyDict({(1,0):1,(0,1):-1}) sage: P(a) x - y
Despite the fact that polydicts are no longer used, I can't think of any reason why one would need this construction. More efficient (and less prone to breakage in the future is) direct construction from a dict.
sage: P.<x,y> = ZZ[] sage: P({(1,0):1,(0,1):-1}) x - y
Changed 12 years ago by
comment:4 Changed 12 years ago by
- Summary changed from modular polynomials database is broken to [with patch, needs review] modular polynomials database is broken
The attached patch removes the uses of polydict.
comment:5 Changed 12 years ago by
- Summary changed from [with patch, needs review] modular polynomials database is broken to [with patch, with positive review] modular polynomials database is broken
comment:6 Changed 12 years ago by
- Milestone changed from sage-3.4.1 to sage-3.3
- Resolution set to fixed
- Status changed from new to closed
Merged in Sage 3.3.alpha2.
Cheers,
Michael
Note: See
TracTickets for help on using
tickets.
Somewhere between sage-3.0.2 and sage-3.1.4 this broke:
sage: P.<X,Y> = PolynomialRing?(ZZ,2) sage: P(sage.rings.polynomial.polydict.PolyDict?({(1,0):1,(0,1):-1})) X - Y
This looks like a problem with a change to the new coercion model; I will temporarily reassign to mabshoff. Perhaps I am using access to the internal datastructure which has changed and/or not meant to be accessible. In that case he can send it back to me.