Skip to content
New issue

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

Inconsistency in matrix() #19134

Closed
mezzarobba opened this issue Sep 4, 2015 · 1 comment
Closed

Inconsistency in matrix() #19134

mezzarobba opened this issue Sep 4, 2015 · 1 comment

Comments

@mezzarobba
Copy link
Member

sage: matrix(2, 3, [])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-2927290cdaf3> in <module>()
----> 1 matrix(Integer(2), Integer(3), [])

/home/marc/opt/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in _matrix_constructor(*args, **kwds)
    647 
    648             if nrows > 0 and ncols > 0 and ring is None:
--> 649                 entries, ring = prepare(entries)
    650 
    651         elif isinstance(args[0], dict):

/home/marc/opt/sage/local/lib/python2.7/site-packages/sage/matrix/constructor.pyc in prepare(w)
    794         TypeError: unable to find a common ring for all elements
    795     """
--> 796     if 0 == len(w):
    797         return Sequence([], rings.ZZ), rings.ZZ
    798     entries = Sequence(w)

TypeError: object of type 'int' has no len()

Compare:

sage: matrix(ZZ, 2, 3, [])
[0 0 0]
[0 0 0]
sage: matrix(2, 3, [1])
...
ValueError: entries has the wrong length

Component: linear algebra

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

@mezzarobba mezzarobba added this to the sage-6.9 milestone Sep 4, 2015
@jdemeyer
Copy link

comment:1

Fixed in #24742. All the commands from the description become errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants