#13101: enumerate_totallyreal_fields bug fix
-----------------------------+----------------------------------------------
Reporter: jvoight | Owner: davidloeffler
Type: defect | Status: new
Priority: major | Milestone: sage-5.1
Component: number fields | Keywords:
Work issues: | Report Upstream: N/A
Reviewers: citro | Authors:
Merged in: | Dependencies:
Stopgaps: |
-----------------------------+----------------------------------------------
sage: enumerate_totallyreal_fields_all(8, 10^8)
---------------------------------------------------------------------------
IndexError Traceback (most recent call
last)
/home/jvoight/sage-4.2/devel/sage-main/sage/rings/number_field/<ipython
console> in <module>()
/usr/local/share/sage-5.0/local/lib/python2.7/site-
packages/sage/rings/number_field/totallyreal_rel.pyc in
enumerate_totallyreal_fields_all(n, B, verbose, return_seqs)
887 print "Taking F =", Sds[i][1]
888 F = NumberField(ZZx(Sds[i][1]), 't')
--> 889 T = enumerate_totallyreal_fields_rel(F, n/d, B,
verbose=verbose, return_seqs=return_seqs)
890 if return_seqs:
891 for i in range(3):
/usr/local/share/sage-5.0/local/lib/python2.7/site-
packages/sage/rings/number_field/totallyreal_rel.pyc in
enumerate_totallyreal_fields_rel(F, m, B, a, verbose, return_seqs)
726 T.incr(f_out,verbose)
727 else:
--> 728 T.incr(f_out)
729
730 Fx = PolynomialRing(F, 'xF')
/usr/local/share/sage-5.0/local/lib/python2.7/site-
packages/sage/rings/number_field/totallyreal_rel.pyc in incr(self, f_out,
verbose, haltk)
542 # New bounds from Lagrange multiplier in
degree 3.
543 bminmax =
[lagrange_degree_3(m,v(self.a[m-1]),v(self.a[m-2]),v(self.a[m-3])) for v
in self.Foo]
--> 544 self.b_lower = [bminmax[i][0] for i in
range(len(bminmax))]
545 self.b_upper = [bminmax[i][1] for i in
range(len(bminmax))]
546
IndexError: list index out of range
The fix is easy: we just need to add the lines
if len(z4minmax) < 1:
z4minmax = [0.0, -1.0]
[ return z4minmax ]
before line 295 of sage/rings/number_field/totallyreal_data.pyx. (Yes,
I'm still intimidated by creating a patch.)
The issue was that when the lagrange multipliers gives contradictory
bounds (a good thing, since it says the enumeration can stop in that
branch), it was not sending a pair of bounds, just a single element,
causing a type error.
JV
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13101>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.