Opened 8 years ago
Closed 8 years ago
#11234 closed defect (fixed)
Fractional ideal class double exponentiation fails
Reported by: | jdemeyer | Owned by: | davidloeffler |
---|---|---|---|
Priority: | major | Milestone: | sage-4.7.1 |
Component: | number fields | Keywords: | pari class group |
Cc: | Merged in: | sage-4.7.1.alpha0 | |
Authors: | Francis Clarke | Reviewers: | Jeroen Demeyer |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
sage: k.<a> = NumberField(x^2 + 20072); G = k.class_group(); (G.0^2)^2 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /usr/local/src/sage-4.7.alpha4/<ipython console> in <module>() /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/rings/number_field/class_group.pyc in __pow__(self, n) 302 # we go along; actually computing self.__ideal ** n would 303 # be disastrous. --> 304 n = n % self.order() 305 return MonoidElement.__pow__(self, n) 306 /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/rings/number_field/class_group.pyc in order(self) 392 """ 393 # an old method with a new docstring --> 394 return AbelianGroupElement.order(self) 395 396 def multiplicative_order(self): /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/groups/abelian_gps/abelian_group_element.pyc in order(self) 304 return o 305 L = list(self.list()) --> 306 N = LCM([invs[i]//GCD(invs[i],L[i]) for i in range(len(invs)) if L[i]!=0]) 307 if N == 0: 308 return infinity /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/rings/integer.so in sage.rings.integer.Integer.__floordiv__ (sage/rings/integer.c:12659)() /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.bin_op (sage/structure/element.c:19135)() /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.bin_op (sage/structure/element.c:19033)() /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:6498)() /usr/local/src/sage-4.7.alpha4/local/lib/python2.6/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:6436)() TypeError: unsupported operand type(s) for //: 'sage.libs.pari.gen.gen' and 'sage.libs.pari.gen.gen'
Both patches should be applied.
Attachments (2)
Change History (11)
comment:1 Changed 8 years ago by
- Description modified (diff)
- Summary changed from Fractional ideal class multiplication sometimes fails to Fractional ideal class double exponentiation fails
Changed 8 years ago by
comment:2 follow-up: ↓ 3 Changed 8 years ago by
- Status changed from new to needs_review
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 5 Changed 8 years ago by
- Status changed from needs_review to needs_work
Replying to fwclarke:
The root cause of this defect is that the coordinates of class group elements were Pari integers.
The problem wasn't detected before because only generators were tested in the doctests for
sage.rings.number_field.class_group.FractionalIdealClass.order
.The attached patch fixes the problem and alters one doctest.
Thanks, I will test it. However, you should add a doctest to show that the problem from this ticket is fixed (so needs_work for this reason).
comment:4 Changed 8 years ago by
- Description modified (diff)
comment:5 in reply to: ↑ 3 Changed 8 years ago by
Replying to jdemeyer:
you should add a doctest to show that the problem from this ticket is fixed.
Done. All the previous tests only took powers of a generator.
comment:6 Changed 8 years ago by
- Status changed from needs_work to needs_review
comment:7 Changed 8 years ago by
- Reviewers set to Jeroen Demeyer
- Status changed from needs_review to positive_review
Looks good! Patch makes sense and fixes the problem.
comment:8 Changed 8 years ago by
comment:9 Changed 8 years ago by
- Merged in set to sage-4.7.1.alpha0
- Resolution set to fixed
- Status changed from positive_review to closed
The root cause of this defect is that the coordinates of class group elements were Pari integers.
The problem wasn't detected before because only generators were tested in the doctests for
sage.rings.number_field.class_group.FractionalIdealClass.order
.The attached patch fixes the problem and alters one doctest.