#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: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
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 (2)
Change History (8)
Changed 14 years ago by
Attachment: | trac_4899.patch added |
---|
comment:1 Changed 14 years ago by
Summary: | bug in sqrt(1) over GF(2^e) for e>15 → [with patch, needs review (trivial!)] bug in sqrt(1) over GF(2^e) for e>15 |
---|
Changed 14 years ago by
Attachment: | trac_4899-referee.patch added |
---|
comment:2 Changed 14 years ago by
Summary: | [with patch, needs review (trivial!)] bug in sqrt(1) over GF(2^e) for e>15 → [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.
comment:4 Changed 14 years ago by
Milestone: | sage-3.4 → sage-3.2.3 |
---|
comment:5 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Merged both patches in Sage 3.2.3.final
comment:6 Changed 14 years ago by
Never mind, John's patch contained a doctest as William just pointed out to me in IRC.
Cheers,
Michael
apply this after trac_4899.patch