Skip to content

matlab matrix conversion issue #2119

@sagetrac-mabshoff

Description

@sagetrac-mabshoff

Reported by Kate:

a0 = matlab('eye(50)')
sage: a1 = matrix(ZZ,a0)
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

/home/mabshoff/<ipython console> in <module>()

/home/was/s/local/lib/python2.5/site-packages/sage/matrix/constructor.py in matrix(arg0, arg1, arg2, arg3, sparse)
    287     
    288     if hasattr(arg1, '_matrix_'):
--> 289         return arg1._matrix_(arg0)
    290 
    291     if arg0 is None:

/home/was/s/local/lib/python2.5/site-packages/sage/interfaces/matlab.py in _matrix_(self, R)
    283         M = MatrixSpace(R, nrows, ncols)
    284         v = sum([[x for x in w.split()] for w in v], [])
--> 285         return M(v)
    286 
    287     def set(self, i, j, x):

/home/was/s/local/lib/python2.5/site-packages/sage/matrix/matrix_space.py in __call__(self, entries, coerce, copy, rows)
    352             return self(entries.matrix(), copy=False)
    353 
--> 354         return self.matrix(entries, copy=copy, coerce=coerce, rows=rows)
    355 
    356     def change_ring(self, R):

/home/was/s/local/lib/python2.5/site-packages/sage/matrix/matrix_space.py in matrix(self, x, coerce, copy, rows)
    965                 x = new_x
    966             
--> 967         return self.__matrix_class(self, entries=x, copy=copy, coerce=coerce) 
    968      
    969     def matrix_space(self, nrows=None, ncols=None, sparse=False):

/home/mabshoff/matrix_integer_dense.pyx in sage.matrix.matrix_integer_dense.Matrix_integer_dense.__init__()

<type 'exceptions.TypeError'>: entries has the wrong length

Cheers,

Michael

Component: misc

Keywords: matlab conversion

Author: Mike Hansen

Reviewer: Ross Kyprianou

Merged: sage-4.5.2.alpha1

Issue created by migration from https://trac.sagemath.org/ticket/2119

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions