Solve Binary Linear System

178 views
Skip to first unread message

Juan Grados

unread,
Apr 17, 2013, 4:45:57 PM4/17/13
to sage-support
I have the equation Ax=b where all matrix entries and all entrie of vector b are in GF(2). How I will be able to solve this linear system equation over GF(2) in SAGE software?

--
---------------------------------------------------------------------
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica 
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
---------------------------------------------------------------------

Robert Bradshaw

unread,
Apr 17, 2013, 5:27:30 PM4/17/13
to sage-s...@googlegroups.com
sage: A = random_matrix(GF(2), 10000, 10000)
sage: A.det()
1
sage: b = random_vector(GF(2), 10000)
sage: %time x = A \ b
CPU times: user 1.61 s, sys: 0.06 s, total: 1.67 s
Wall time: 1.67 s
sage: A * x == b
True
> --
> 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...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Juan Grados

unread,
Apr 18, 2013, 11:01:38 AM4/18/13
to sage-support
Thanks, 

But if the matrix A is non-square How I will be able to solve?. I am trying but I get number of rows of self must equal degree of B


2013/4/17 Robert Bradshaw <robe...@gmail.com>

John H Palmieri

unread,
Apr 18, 2013, 11:05:55 AM4/18/13
to sage-s...@googlegroups.com


On Thursday, April 18, 2013 8:01:38 AM UTC-7, juaninf wrote:
Thanks, 

But if the matrix A is non-square How I will be able to solve?. I am trying but I get number of rows of self must equal degree of B

This is a math question now. If A is n x k, and if you want to solve Ax = b, then b needs to be an n-dimensional vector. It sounds like you're trying with b of the wrong dimension.

sage: A = random_matrix(GF(2), 10, 20)
sage: b = random_vector(GF(2), 10)
sage: A \ b
(1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)


 
Reply all
Reply to author
Forward
0 new messages