#12412: TypeError when creating a zero map from a zero dimensional vector space
to
a positive dimensional vector space
-----------------------+----------------------------------------------------
Reporter: JStarx | Owner: AlexGhitza
Type: defect | Status: new
Priority: major | Milestone: sage-5.0
Component: algebra | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: Jim Stark
Merged: | Dependencies:
-----------------------+----------------------------------------------------
{{{
sage: V = GF(3)^0
sage: W = GF(3)^1
sage: H = V.Hom(W)
sage: H.zero_element()
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (398, 0))
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
}}}
[snip]
{{{
/Users/Starx/sage/local/lib/python2.6/site-
packages/sage/categories/modules.pyc in zero(self)
205 True
206 """
--> 207 return self(lambda x: self.codomain().zero())
208
209 class EndCategory(HomCategory):
/Users/Starx/sage/local/lib/python2.6/site-
packages/sage/modules/vector_space_homspace.pyc in __call__(self, A,
check)
383 msg = 'vector space homspace can only coerce matrices,
vector space morphisms, functions or lists, not {0}'
384 raise TypeError(msg.format(A))
--> 385 return vector_space_morphism.VectorSpaceMorphism(self, A)
386
387 def _repr_(self):
/Users/Starx/sage/local/lib/python2.6/site-
packages/sage/modules/vector_space_morphism.pyc in __init__(self,
homspace, A)
861 raise TypeError('domain dimension is incompatible with
matrix size')
862 if homspace.codomain().dimension() != A.ncols():
--> 863 raise TypeError('codomain dimension is incompatible
with matrix size')
864
865 A = homspace._matrix_space()(A)
TypeError: codomain dimension is incompatible with matrix size
}}}
The problem here is that sage creates a list of lists from that lambda
function and then a matrix from those lists, so the list of lists results
in a 0x0 matrix instead of a 0x1 matrix. The fix is to just add the
dimensions to the matrix constructor in vector_space_homspace.py, I will
post a patch shortly.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12412>
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.