On 03/07/2015 10:16 AM, William Stein wrote:
On Fri, Mar 6, 2015 at 6:10 PM, Michael Orlitzky <[email protected]> wrote:
> On 03/06/2015 08:10 PM, P Purkayastha wrote:
>>>
>>>
>> This is a serious bug. Is there a ticket for this?
>>
>
> It sort of falls under this one:
>
>    http://trac.sagemath.org/ticket/7392
>
> even though a fix for that ticket might not affect some similar examples.

If you change the definition of rank, make sure to not do the
following, like I just thought I should do for a few minutes:

sage: n = matrix([ [-0.3, 0.2, 0.1], [0.2, -0.4, 0.4], [0.1, 0.2, -0.5] ])
sage: a = n.numpy()
sage: import numpy
sage: numpy.rank(a)
2

It looks right... but it's 2 because it's a 2-dimensional array :-)

sage: numpy.rank(numpy.zeros((1,2,4)))
3

Anyway, now you see how numerical people use the word "rank"...

William



Well, something is clearly very wrong with either rank() or with ==. Since the 
matrices can be changed from one ring to another and they give True on equality 
it makes no sense for them to give different ranks.



I don't think a typical user wants to go deep into mathematics and try to 
figure out what should be the correct way to determine the rank of a matrix. It 
should give the correct answer. Otherwise the method should be removed from 
fields that can give incorrect results.

sage: m.change_ring(RDF)
[-0.3  0.2  0.1]
[ 0.2 -0.4  0.4]
[ 0.1  0.2 -0.5]
sage: n.change_ring(QQ)
[-3/10   1/5  1/10]
[  1/5  -2/5   2/5]
[ 1/10   1/5  -1/2]
sage: m.change_ring(RDF).rank()
3
sage: n.change_ring(QQ).rank()
2

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to