Re: [sage-support] Re: solving a linear system of GF(3) -- strange TypeError

2019-10-09 Thread David Joyner
On Wed, Oct 9, 2019 at 1:33 AM Robert Samal  wrote:

> Sorry, F=GF(3), I made my original example shorter and didn't read it
> properly.
>
> So the full problematic code is
>
> B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
> v=vector(GF(3), [1,1])
> B.solve_right(v)
>
>
Yes. I can confirm it works with "sparse=True" removed *or* if GF(3) is
replaced by ZZ.
So there's an easy workaround but maybe the docs or the code has a bug?
Thanks for reporting.

Thanks,
>
> Robert
>
>
> On Tuesday, October 8, 2019 at 5:17:59 PM UTC-7, Robert Samal wrote:
>>
>> I am trying to solve a rather large linear systems of equations of GF(3).
>> As the matrices are sparse, I thought that adding "sparse=True" to the
>> constructor of the matrix could be of help. However, I ran to a strange
>> error message.
>>
>> B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
>> v=vector(F, [1,1])
>> B.solve_right(v)
>>
>> The above code yields the following
>>
>> TypeError: Cannot convert sage.matrix.matrix_modn_sparse.Matrix_modn_sparse 
>> to sage.matrix.matrix_integer_sparse.Matrix_integer_sparse
>>
>>
>> I am hesitant to paste the whole error message here, but it ends with 
>> reference to file
>> SageMath/local/lib/python2.7/site-packages/sage/matrix/matrix_modn_sparse.pyx
>>  in
>> sage.matrix.matrix_modn_sparse.Matrix_modn_sparse._solve_matrix_linbox
>> (build/cythonized/sage/matrix/matrix_modn_sparse.cpp:11633).
>>
>> I am using Sage 8.9, but the same issue was on 8.7 as well.
>>
>> Few other observations:
>> -- works as expected for dense matrices -- or for sparse ones over integers
>> -- the same issue occurs whether y is a vector or a matrix
>> -- It behaves the same for systems with no solution.
>>
>> Is there some hidden limitation of sparse matrices over finite fields?
>> I.e., is it a bug or feature? :-)
>> I tried to RTFM, but couldn't find this discussed. The page for sparse 
>> matrices over
>> finite fields does not exactly promise the solve method, but it does not 
>> mention it
>> would not work either. Is it possible to achieve what I want by other means 
>> (in Sage).
>>
>> Thanks.
>>
>>
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/6ac68e19-7c5a-4be1-ba10-1bac22cddc62%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAEQuuAWQYKhtkVme8wHkJTj38QkmfnSJf3_Lhtqj9PxJmq8HcQ%40mail.gmail.com.


Re: [sage-support] Re: solving a linear system of GF(3) -- strange TypeError

2019-10-09 Thread Dima Pasechnik
This got broken in Sage 8.5.
(still works in 8.4)



On Wed, Oct 9, 2019 at 6:09 AM David Joyner  wrote:

>
>
> On Wed, Oct 9, 2019 at 1:33 AM Robert Samal 
> wrote:
>
>> Sorry, F=GF(3), I made my original example shorter and didn't read it
>> properly.
>>
>> So the full problematic code is
>>
>> B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
>> v=vector(GF(3), [1,1])
>> B.solve_right(v)
>>
>>
> Yes. I can confirm it works with "sparse=True" removed *or* if GF(3) is
> replaced by ZZ.
> So there's an easy workaround but maybe the docs or the code has a bug?
> Thanks for reporting.
>
> Thanks,
>>
>> Robert
>>
>>
>> On Tuesday, October 8, 2019 at 5:17:59 PM UTC-7, Robert Samal wrote:
>>>
>>> I am trying to solve a rather large linear systems of equations of
>>> GF(3). As the matrices are sparse, I thought that adding "sparse=True" to
>>> the constructor of the matrix could be of help. However, I ran to a strange
>>> error message.
>>>
>>> B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
>>> v=vector(F, [1,1])
>>> B.solve_right(v)
>>>
>>> The above code yields the following
>>>
>>> TypeError: Cannot convert sage.matrix.matrix_modn_sparse.Matrix_modn_sparse 
>>> to sage.matrix.matrix_integer_sparse.Matrix_integer_sparse
>>>
>>>
>>> I am hesitant to paste the whole error message here, but it ends with 
>>> reference to file
>>> SageMath/local/lib/python2.7/site-packages/sage/matrix/matrix_modn_sparse.pyx
>>>  in
>>> sage.matrix.matrix_modn_sparse.Matrix_modn_sparse._solve_matrix_linbox
>>> (build/cythonized/sage/matrix/matrix_modn_sparse.cpp:11633).
>>>
>>> I am using Sage 8.9, but the same issue was on 8.7 as well.
>>>
>>> Few other observations:
>>> -- works as expected for dense matrices -- or for sparse ones over integers
>>> -- the same issue occurs whether y is a vector or a matrix
>>> -- It behaves the same for systems with no solution.
>>>
>>> Is there some hidden limitation of sparse matrices over finite fields?
>>> I.e., is it a bug or feature? :-)
>>> I tried to RTFM, but couldn't find this discussed. The page for sparse 
>>> matrices over
>>> finite fields does not exactly promise the solve method, but it does not 
>>> mention it
>>> would not work either. Is it possible to achieve what I want by other means 
>>> (in Sage).
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sage-support+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-support/6ac68e19-7c5a-4be1-ba10-1bac22cddc62%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/CAEQuuAWQYKhtkVme8wHkJTj38QkmfnSJf3_Lhtqj9PxJmq8HcQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq0g7uzjcPfs69Q8yW54_GrEjGG3gxXar46XWReXrqVfAQ%40mail.gmail.com.


Re: [sage-support] Re: solving a linear system of GF(3) -- strange TypeError

2019-10-09 Thread Robert Samal
Indeed it works in Sage 8.4. 
Thanks!

On Wednesday, October 9, 2019 at 8:34:41 AM UTC-7, Dima Pasechnik wrote:
>
> This got broken in Sage 8.5.
> (still works in 8.4)
>
>
>
> On Wed, Oct 9, 2019 at 6:09 AM David Joyner  > wrote:
>
>>
>>
>> On Wed, Oct 9, 2019 at 1:33 AM Robert Samal > > wrote:
>>
>>> Sorry, F=GF(3), I made my original example shorter and didn't read it 
>>> properly. 
>>>
>>> So the full problematic code is
>>>
>>> B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
>>> v=vector(GF(3), [1,1])
>>> B.solve_right(v)
>>>
>>>
>> Yes. I can confirm it works with "sparse=True" removed *or* if GF(3) is 
>> replaced by ZZ.
>> So there's an easy workaround but maybe the docs or the code has a bug? 
>> Thanks for reporting. 
>>
>> Thanks, 
>>>
>>> Robert
>>>
>>>
>>> On Tuesday, October 8, 2019 at 5:17:59 PM UTC-7, Robert Samal wrote:

 I am trying to solve a rather large linear systems of equations of 
 GF(3). As the matrices are sparse, I thought that adding "sparse=True" to 
 the constructor of the matrix could be of help. However, I ran to a 
 strange 
 error message. 

 B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
 v=vector(F, [1,1])
 B.solve_right(v)

 The above code yields the following

 TypeError: Cannot convert 
 sage.matrix.matrix_modn_sparse.Matrix_modn_sparse to 
 sage.matrix.matrix_integer_sparse.Matrix_integer_sparse


 I am hesitant to paste the whole error message here, but it ends with 
 reference to file 
 SageMath/local/lib/python2.7/site-packages/sage/matrix/matrix_modn_sparse.pyx
  in 
 sage.matrix.matrix_modn_sparse.Matrix_modn_sparse._solve_matrix_linbox 
 (build/cythonized/sage/matrix/matrix_modn_sparse.cpp:11633). 

 I am using Sage 8.9, but the same issue was on 8.7 as well. 

 Few other observations:
 -- works as expected for dense matrices -- or for sparse ones over integers
 -- the same issue occurs whether y is a vector or a matrix
 -- It behaves the same for systems with no solution.

 Is there some hidden limitation of sparse matrices over finite fields? 
 I.e., is it a bug or feature? :-) 
 I tried to RTFM, but couldn't find this discussed. The page for sparse 
 matrices over
 finite fields does not exactly promise the solve method, but it does not 
 mention it 
 would not work either. Is it possible to achieve what I want by other 
 means (in Sage). 

 Thanks. 




 -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "sage-support" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to sage-s...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sage-support/6ac68e19-7c5a-4be1-ba10-1bac22cddc62%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sage-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-s...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/CAEQuuAWQYKhtkVme8wHkJTj38QkmfnSJf3_Lhtqj9PxJmq8HcQ%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/5ce4410e-1ee7-4ebd-a5a6-903e893c1b77%40googlegroups.com.


Re: [sage-support] Re: solving a linear system of GF(3) -- strange TypeError

2019-10-09 Thread Dima Pasechnik
This is now https://trac.sagemath.org/ticket/28586

It would be great not to have to do git bisect on this, anyone can point
out to a suspect ticket?
Thanks!

On Thu, Oct 10, 2019 at 12:06 AM Robert Samal 
wrote:

> Indeed it works in Sage 8.4.
> Thanks!
>
> On Wednesday, October 9, 2019 at 8:34:41 AM UTC-7, Dima Pasechnik wrote:
>>
>> This got broken in Sage 8.5.
>> (still works in 8.4)
>>
>>
>>
>> On Wed, Oct 9, 2019 at 6:09 AM David Joyner  wrote:
>>
>>>
>>>
>>> On Wed, Oct 9, 2019 at 1:33 AM Robert Samal  wrote:
>>>
 Sorry, F=GF(3), I made my original example shorter and didn't read it
 properly.

 So the full problematic code is

 B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
 v=vector(GF(3), [1,1])
 B.solve_right(v)


>>> Yes. I can confirm it works with "sparse=True" removed *or* if GF(3) is
>>> replaced by ZZ.
>>> So there's an easy workaround but maybe the docs or the code has a bug?
>>> Thanks for reporting.
>>>
>>> Thanks,

 Robert


 On Tuesday, October 8, 2019 at 5:17:59 PM UTC-7, Robert Samal wrote:
>
> I am trying to solve a rather large linear systems of equations of
> GF(3). As the matrices are sparse, I thought that adding "sparse=True" to
> the constructor of the matrix could be of help. However, I ran to a 
> strange
> error message.
>
> B=matrix(GF(3), 2,2,[1,0,1,0], sparse=True)
> v=vector(F, [1,1])
> B.solve_right(v)
>
> The above code yields the following
>
> TypeError: Cannot convert 
> sage.matrix.matrix_modn_sparse.Matrix_modn_sparse to 
> sage.matrix.matrix_integer_sparse.Matrix_integer_sparse
>
>
> I am hesitant to paste the whole error message here, but it ends with 
> reference to file
> SageMath/local/lib/python2.7/site-packages/sage/matrix/matrix_modn_sparse.pyx
>  in
> sage.matrix.matrix_modn_sparse.Matrix_modn_sparse._solve_matrix_linbox
> (build/cythonized/sage/matrix/matrix_modn_sparse.cpp:11633).
>
> I am using Sage 8.9, but the same issue was on 8.7 as well.
>
> Few other observations:
> -- works as expected for dense matrices -- or for sparse ones over 
> integers
> -- the same issue occurs whether y is a vector or a matrix
> -- It behaves the same for systems with no solution.
>
> Is there some hidden limitation of sparse matrices over finite fields?
> I.e., is it a bug or feature? :-)
> I tried to RTFM, but couldn't find this discussed. The page for sparse 
> matrices over
> finite fields does not exactly promise the solve method, but it does not 
> mention it
> would not work either. Is it possible to achieve what I want by other 
> means (in Sage).
>
> Thanks.
>
>
>
>
> --
 You received this message because you are subscribed to the Google
 Groups "sage-support" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to sage-s...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/sage-support/6ac68e19-7c5a-4be1-ba10-1bac22cddc62%40googlegroups.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sage-support" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to sage-s...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/sage-support/CAEQuuAWQYKhtkVme8wHkJTj38QkmfnSJf3_Lhtqj9PxJmq8HcQ%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/5ce4410e-1ee7-4ebd-a5a6-903e893c1b77%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq3Vx0K5YT_WM_M280f1%2B_5uQp0vuPYrHGaVdncR1vC2Aw%40mail.gmail.com.