Re: [sage-support] Re: Strange interaction between sage and numpy

2012-01-09 Thread Vegard Lima
On Sun, Jan 8, 2012 at 6:23 PM, Volker Braun vbraun.n...@gmail.com wrote:
 Just noticed the following:

 sage: import numpy as np
 sage: r=10
 sage: c=76
 sage: A = 2*np.random.randint(2, size=(r,c))-np.ones((r,c),dtype=np.int)
 sage: A = matrix(QQ,A)
 sage: A
 10 x 76 dense matrix over Integer Ring (type 'print A.str()' to see all of
 the entries)

 So matrix(QQ,numpy) actually constructs a matrix over ZZ. Thats somewhat
 unexpected.

Ok, I saw that you opened a ticket for the right_kernel thing:
http://trac.sagemath.org/sage_trac/ticket/12280

Should I create a new ticket for this matrix(QQ,numpy) thing?


Thanks,
-- 
Vegard Lima

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


Re: [sage-support] Re: Strange interaction between sage and numpy

2012-01-09 Thread Volker Braun
Sure! I suspect it would be relatively easy to fix 
in sage/matrix/constructor.py if you want to give it a try! But in any case 
please open a ticket.


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


Re: [sage-support] Re: Strange interaction between sage and numpy

2012-01-09 Thread Vegard Lima
Created this ticket for the numpy array to matrix issue:
http://trac.sagemath.org/sage_trac/ticket/12287

On Mon, Jan 9, 2012 at 4:20 PM, Volker Braun vbraun.n...@gmail.com wrote:
 Sure! I suspect it would be relatively easy to fix
 in sage/matrix/constructor.py if you want to give it a try! But in any case
 please open a ticket.

Thanks,
-- 
Vegard Lima

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


[sage-support] Re: Strange interaction between sage and numpy

2012-01-08 Thread Dima Pasechnik
It's hard to say whether it's a linear algebra bug, or matrix creation bug.
Could you check that the result of A = matrix(QQ,A) actually makes sense?

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


Re: [sage-support] Re: Strange interaction between sage and numpy

2012-01-08 Thread Vegard Lima
On Sun, Jan 8, 2012 at 9:12 AM, Dima Pasechnik dimp...@gmail.com wrote:
 It's hard to say whether it's a linear algebra bug, or matrix creation bug.
 Could you check that the result of A = matrix(QQ,A) actually makes sense?

It looks ok to me:
sage: A = matrix(QQ,A)
sage: A
10 x 76 dense matrix over Integer Ring (type 'print A.str()' to see
all of the entries)
sage: A.str()
'[ 1 -1  1  1  1  1 -1 -1  1 -1  1 -1  1 -1 -1 -1  1 -1  1 -1 -1 -1 etc etc...

The thing is that the A.right_kernel_matrix() is padded with zeros.
It has rank - (dim null space) extra zero columns.
The first dim null space columns are correctly computed.

Thanks,
-- 
Vegard Lima

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


Re: [sage-support] Re: Strange interaction between sage and numpy

2012-01-08 Thread Volker Braun
I looked into it a bit and it seems to be an IML bug. Presumably 75 is some 
cutoff inside IML, though I haven't verified this. You get the right answer 
if you use a different backend to compute the kernel:

sage: matrix(QQ,A).right_kernel(algorithm='generic').dimension()+A.rank()
76

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


Re: [sage-support] Re: Strange interaction between sage and numpy

2012-01-08 Thread Volker Braun
Just noticed the following:

sage: import numpy as np
sage: r=10
sage: c=76
sage: A = 2*np.random.randint(2, size=(r,c))-np.ones((r,c),dtype=np.int)
sage: A = matrix(QQ,A)
sage: A
10 x 76 dense matrix over Integer Ring (type 'print A.str()' to see all of 
the entries)

So matrix(QQ,numpy) actually constructs a matrix over ZZ. Thats somewhat 
unexpected.

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