Ticket #4899 (closed defect: fixed)
[with patch, positive review] bug in sqrt(1) over GF(2^e) for e>15
| Reported by: | cremona | Owned by: | tbd |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-3.2.3 |
| Component: | algebra | Keywords: | finite fields |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
sage: GF(2^15,'a')(1).sqrt() 1 sage: GF(2^16,'a')(1).sqrt() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/john/<ipython console> in <module>() /home/john/sage-3.2.2.rc1/local/lib/python2.5/site-packages/sage/rings/finite_field_ntl_gf2e.so in sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_gf2eElement.sqrt (sage/rings/finite_field_ntl_gf2e.cpp:7072)() AttributeError: 'sage.rings.finite_field_ntl_gf2e.FiniteField_ntl_g' object has no attribute '_one_element'
The point is that GF(2^16) (and higher) are of type 'sage.rings.finite_field_ntl_gf2e.FiniteField?_ntl_gf2e' and the code (lines 826,827 in finite_field_ntl_gf2e.pyx)
if self.is_one():
return self._one_element
fails. It should be self.parent()._one_element (though I don't know why "return self" would not be ok too).
Patch up very soon.
Attachments
Change History
comment:1 Changed 4 years ago by cremona
- Summary changed from bug in sqrt(1) over GF(2^e) for e>15 to [with patch, needs review (trivial!)] bug in sqrt(1) over GF(2^e) for e>15
Changed 4 years ago by was
-
attachment
trac_4899-referee.patch
added
apply this after trac_4899.patch
comment:2 Changed 4 years ago by was
- Summary changed from [with patch, needs review (trivial!)] bug in sqrt(1) over GF(2^e) for e>15 to [with patch, positive review] bug in sqrt(1) over GF(2^e) for e>15
REFEREE REPORT:
Nice find. You remark "It should be self.parent()._one_element (though I don't know why "return self" would not be ok too).". In fact, I think returning self would be ok. I tried that and it is also over twice as fast. So I've posted a followup patch that does that instead.
Note: See
TracTickets for help on using
tickets.
