#10613: Trouble coercing a vector directly to a matrix
------------------------------+---------------------------------------------
Reporter: jonhanke | Owner: jason, was
Type: defect | Status: new
Priority: minor | Milestone: sage-4.6.1
Component: linear algebra | Keywords: matrix, vector, coercion
Author: Jonathan Hanke | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Vector to matrix coercion appears not to work unless going through a list.
{{{
sage: v = vector(QQ,[1,2,3])
sage: v
(1, 2, 3)
sage: type(v)
<type 'sage.modules.vector_rational_dense.Vector_rational_dense'>
sage:
sage: Matrix(QQ, 3,1,v)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/jonhanke/Documents/SAGE/sage-4.6/<ipython console> in <module>()
/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python2.6/site-
packages/sage/matrix/constructor.pyc in matrix(*args, **kwds)
660 ring = rings.ZZ
661
--> 662 return matrix_space.MatrixSpace(ring, nrows, ncols,
sparse=sparse)(entries)
663
664
/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python2.6/site-
packages/sage/matrix/matrix_space.pyc in __call__(self, entries, coerce,
copy, rows)
403 return self(entries.matrix(), copy=False)
404
--> 405 return self.matrix(entries, copy=copy, coerce=coerce,
rows=rows)
406
407 def change_ring(self, R):
/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python2.6/site-
packages/sage/matrix/matrix_space.pyc in matrix(self, x, coerce, copy,
rows)
1134 x = new_x
1135
-> 1136 return self.__matrix_class(self, entries=x, copy=copy,
coerce=coerce)
1137
1138 def matrix_space(self, nrows=None, ncols=None, sparse=False):
/Users/jonhanke/Documents/SAGE/sage-4.6/local/lib/python2.6/site-
packages/sage/matrix/matrix_rational_dense.so in
sage.matrix.matrix_rational_dense.Matrix_rational_dense.__init__
(sage/matrix/matrix_rational_dense.c:5774)()
TypeError: entries must be coercible to a list or integer
sage: Matrix(QQ, 3,1, list(v))
[1]
[2]
[3]
sage:
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10613>
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.