On Mar 15, 3:48 am, Alec Mihailovs <[email protected]> wrote:
> That seems to be a bug introduced in Sage, not in numpy,
>
> sage: fromfunction(lambda i,j:i-j+3,(1,1),dtype=int)
>
> array([[3]])
>
> sage: matrix(_)
>
> [0 0 0]
> [0 0 0]
> [0 0 0]

Yes, and that happens with other numpy 1x1 arrays as well, converted
to matrices,

from numpy import array
a5=array([[5]])
matrix(a5)

[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]

I looked at the

matrix??

and the problem seems to be caused by the block of code starting from

if len(args) >= 1:
        # check to see if the number of rows is specified
        try:
            nrows = int(args[0])
            args.pop(0)

because of the following numpy arrays feature:

int(a5)
5

By the way, if that will go into a ticket, it would be nice if also
the possibility of defining a matrix through a function be added to
the matrix constructor (along David Joyner's suggestion).

Alec Mihailovs

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to