Opened 4 years ago

Closed 21 months ago

Last modified 21 months ago

#19134 closed defect (duplicate)

Inconsistency in matrix()

Reported by: mmezzarobba Owned by:
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

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

Change History (1)

comment:1 Changed 21 months ago by jdemeyer

  • Milestone changed from sage-6.9 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed

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

Last edited 21 months ago by jdemeyer (previous) (diff)
Note: See TracTickets for help on using tickets.