Matrix of operations after gaussian elimination

42 views
Skip to first unread message

Juan Grados

unread,
Jun 9, 2017, 12:48:17 AM6/9/17
to sage-support
I need the Matrix of operations after gaussian elimination in sage. How Can I get that?

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

Kwankyu

unread,
Jun 9, 2017, 3:01:02 AM6/9/17
to sage-support
Is this what you want?

sage: m = matrix(2,[1,2,3,4])
sage: H,U = m.echelon_form(transformation=True)
sage: H
[1 0]
[0 2]
sage: U
[-2 1]
[ 3 -1]
sage: U * m == H
True

Juan Grados

unread,
Jun 9, 2017, 10:54:53 PM6/9/17
to sage-support
Thank by I get
ValueError: too many values to unpack

I think because my matrix has entries in GF(2).

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Simon King

unread,
Jun 10, 2017, 5:52:21 AM6/10/17
to sage-s...@googlegroups.com
Hi Juan,

On 2017-06-10, Juan Grados <jua...@gmail.com> wrote:
> Thank by I get
>
> ValueError: too many values to unpack
>
> I think because my matrix has entries in GF(2).

You are right. According to the documentation:
* "transformation" -- boolean. Whether to also return the
transformation matrix. Some matrix backends do not provide this
information, in which case this option is ignored.

So, unfortunately, it doesn't give the desired transformation
matrix.

Depending on your application, it could be that LU decomposition
does what you need.

Best regards,
Simon

Juan Grados

unread,
Jun 10, 2017, 6:06:40 AM6/10/17
to sage-support
I need an implementaton to perfom a Gaussian elimination on a matrix with entries in GF(2). This implementation should return a transformation matrix and the result of the gassual elimination.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Juan Grados

unread,
Jun 10, 2017, 7:22:18 AM6/10/17
to sage-support
More specifically, I need transform a partity check matrix into a systematic form, but I need the transform matrix

Johan S. H. Rosenkilde

unread,
Jun 10, 2017, 8:23:44 AM6/10/17
to sage-s...@googlegroups.com
Hi Juan

You can just compute it from the result:

sage: H = random_matrix(GF(2), 15, 20)
sage: S = H.echelon_form(transformation=True)
sage: full_rank_submatrix = H.matrix_from_columns(S.pivots())
sage: U = full_rank_submatrix.inverse()
sage: U*H == S
True

Note: this only works if m has full row rank (which it should have if
your input is a parity check matrix). Otherwise, one has to do slightly
more work.

Best,
Johan
>>> email to sage-support...@googlegroups.com.
>>> To post to this group, send email to sage-s...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/sage-support.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> ---------------------------------------------------------------------
>> MSc. Juan del Carmen Grados Vásquez
>> Laboratório Nacional de Computação Científica
>> Tel: +55 21 97633 3228 <(21)%2097633-3228>
Reply all
Reply to author
Forward
0 new messages