Changes between Initial Version and Version 1 of Ticket #10604


Ignore:
Timestamp:
01/12/11 18:57:16 (11 years ago)
Author:
rbeezer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10604 – Description

    initial v1  
    11Diagonal matrix constructor fails when given a tuple, and there is a request to support numpy arrays as input.  This seems easiest to accomplish with a re-write and documentation upgrade.
     2
     3`NumPy` array request:
     4http://groups.google.com/group/sage-devel/browse_thread/thread/f0ecd06fcf9efb1b
     5
     6{{{
     7sage: diagonal_matrix( (1,2,3) )
     8---------------------------------------------------------------------------
     9ValueError                                Traceback (most recent call last)
     10
     11/home/sage/sage-4.6.1.rc1/devel/sage-main/<ipython console> in <module>()
     12
     13/home/sage/sage-4.6.1.rc1/local/lib/python2.6/site-packages/sage/matrix/constructor.pyc in diagonal_matrix(arg0, arg1, arg2, sparse)
     14   1271
     15   1272     if ring is None:
     16-> 1273         return matrix(nrows, nrows, w, sparse=sparse)
     17   1274     else:
     18   1275         return matrix(ring, nrows, nrows, w, sparse=sparse)
     19
     20/home/sage/sage-4.6.1.rc1/local/lib/python2.6/site-packages/sage/matrix/constructor.pyc in matrix(*args, **kwds)
     21    577                         ncols = len(args[0]) // nrows
     22    578                     elif ncols != len(args[0]) // nrows:
     23--> 579                         raise ValueError, "entries has the wrong length"
     24    580                 elif len(args[0]) > 0:
     25    581                     raise ValueError, "entries has the wrong length"
     26
     27ValueError: entries has the wrong length
     28}}}