On Mon, Feb 15, 2010 at 10:59 AM, Robert Bradshaw
<rober...@math.washington.edu> wrote:
> On Feb 15, 2010, at 6:07 AM, Florent Hivert wrote:
>
>>     Hi there,
>>
>> Isn't the following a bug ?
>>
>>   sage: mat = matrix(ZZ, [[1,1],[1,1]], sparse=False)
>>   sage: type(mat)
>>   <type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
>>   sage: mat2 = matrix(ZZ, mat, sparse=True)

I didn't know you could even give a matrix as the input to the matrix
constructor.  If you type "matrix?" you'll see that of the many types
of input that matrix takes, a matrix itself is definitely not one of
them... however the docs specifically say:

   "Calling matrix() with a Sage object may return something that makes sense."

That's what's happening here -- your matrix "mat" is just some sage
object that has an "_matrix_" method.  It's calling that method on
mat.  That method doesn't even take a sparse parameter.

So technically the behavior you're seeing agrees with the stated
documentation, so isn't a bug.  However, I can see how it could be
misleading!   But fixing it could be a can of worms, so... thank you.

 -- William

>>   sage: type(mat2)
>>   <type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
>
> Looks like a bug to me.
>
> - Robert
>
>
> --
> To post to this group, send an email to sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to