We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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:
CC: @williamstein @jonhanke
Component: linear algebra
Keywords: matrix, vector
Issue created by migration from https://trac.sagemath.org/ticket/10613
The text was updated successfully, but these errors were encountered:
If you leave out the dimensions (which would be inferred from the vector), it is possible to build a matrix from a vector.
sage: w=vector(QQ, [1,2,3]) sage: A = Matrix(QQ, w); A [1 2 3] sage: A.parent() Full MatrixSpace of 1 by 3 dense matrices over Rational Field
Sorry, something went wrong.
Changed author from Jonathan Hanke to none
Fixed in #24742
jasongrout
williamstein
No branches or pull requests
Vector to matrix coercion appears not to work unless going through a list.
CC: @williamstein @jonhanke
Component: linear algebra
Keywords: matrix, vector
Issue created by migration from https://trac.sagemath.org/ticket/10613
The text was updated successfully, but these errors were encountered: