#12020: bug in zero_matrix rewrite in matrix_space.py
------------------------------+---------------------------------------------
Reporter: was | Owner: jason, was
Type: defect | Status: needs_work
Priority: blocker | Milestone: sage-duplicate/invalid/wontfix
Component: linear algebra | Keywords:
Work_issues: | Upstream: N/A
Reviewer: William Stein | Author: Martin Albrecht, Jeroen Demeyer
Merged: | Dependencies:
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):
* status: positive_review => needs_work
* reviewer: => William Stein
* author: William Stein => Martin Albrecht, Jeroen Demeyer
Old description:
> Observe this:
>
> {{{
> sage: D=DirichletGroup(20);
> sage: g=D[7].extend(400); #order 4 character
> sage: M=ModularSymbols(g,2,sign=1).cuspidal_subspace()
> sage: N=M.new_subspace()
> TypeError Traceback (most recent call
> last)
>
> /mnt/usb1/scratch/wstein/ref/sage-4.8.alpha2-sage.math.washington.edu-x86_64-Linux/local/lib/python2.6
> /site-packages/sage/rings/number_field/number_field.pyc in
> _coerce_non_number_field_element_in(self, x)
> 5399 except (TypeError, AttributeError), msg:
> 5400 pass
> -> 5401 raise TypeError, type(x)
> 5402
> 5403 def _coerce_from_str(self, x):
> TypeError: <type 'NoneType'>
> }}}
>
> Debugging we see that the problem is that this code in matrix_space.py:
> {{{
> 479 if entries is None or entries == 0:
> 480 if self._copy_zero: # faster to copy than to create a
> new one.
> 481 return self.zero_matrix().__copy__()
> 482 else:
> --> 483 return self.__matrix_class(self, None,
> coerce=coerce, copy=copy)
> }}}
> That None in the last line is then coerced for some reason into a number
> field (Cyclotomic Field of order 4 and degree) which makes no sense
> now...
>
> This bug was introduced in #11589.
>
> '''Apply''' [attachment:trac_12020.2.patch]
New description:
Observe this:
{{{
sage: D=DirichletGroup(20);
sage: g=D[7].extend(400); #order 4 character
sage: M=ModularSymbols(g,2,sign=1).cuspidal_subspace()
sage: N=M.new_subspace()
TypeError Traceback (most recent call
last)
/mnt/usb1/scratch/wstein/ref/sage-4.8.alpha2-sage.math.washington.edu-x86_64-Linux/local/lib/python2.6
/site-packages/sage/rings/number_field/number_field.pyc in
_coerce_non_number_field_element_in(self, x)
5399 except (TypeError, AttributeError), msg:
5400 pass
-> 5401 raise TypeError, type(x)
5402
5403 def _coerce_from_str(self, x):
TypeError: <type 'NoneType'>
}}}
Debugging we see that the problem is that this code in matrix_space.py:
{{{
479 if entries is None or entries == 0:
480 if self._copy_zero: # faster to copy than to create a
new one.
481 return self.zero_matrix().__copy__()
482 else:
--> 483 return self.__matrix_class(self, None,
coerce=coerce, copy=copy)
}}}
That None in the last line is then coerced for some reason into a number
field (Cyclotomic Field of order 4 and degree) which makes no sense now...
This bug was introduced in #11589.
'''Apply''' [attachment:trac_12020_alt.patch] and
[attachment:12020_review.patch]
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12020#comment:18>
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.