gaussian elim with rref(M) over Gf(2)

13 views (last 30 days)
yu kay
yu kay on 16 Mar 2011
Edited: John D'Errico on 30 Mar 2020
Hello!!!
Please how can i make a systematic matrix M. all M's element are over gf(2).(it's means M take value in {0,1}. -I try to do that with matlab function rref but results are not in gf(2). -I add mod(2). but it generate an error -could you help me??? thank's a lot

Answers (1)

John D'Errico
John D'Errico on 30 Mar 2020
Edited: John D'Errico on 30 Mar 2020
Far too late for this question, but in case others want help...
You seem to have asked two questions. First, how to create a symmetric matrix in GF(2) (or perhaps in any field induced by some integer N.)
We can create a matrix in GF(2) easily enough,
A = randi([0,1],[5,5])
A =
1 0 1 0 1
0 0 1 0 1
0 1 0 1 0
1 1 1 0 0
0 0 1 0 1
Of course, it is not symmetric as I generated it. I could symmetrize things by a step like this:
mod(A + A',2)
ans =
0 1 0 0 1
1 0 0 1 1
0 0 0 1 0
0 1 1 0 1
1 1 0 1 0
but you should see that will always result in a zero main diagonal. As well, this does not insure the matrix will be full rank in GF(2).
A simple solution would be to start with a factorization, whereby we can ensure the matrix is non-singular, because my matrix L will be lower triangular, but with a unit main diagonal.
L = tril(randi([0 1],[5 5])) | eye(5)
L =
5×5 logical array
1 0 0 0 0
0 1 0 0 0
1 0 1 0 0
1 0 1 1 0
1 0 0 1 1
A = mod(L*L',2)
A =
1 0 1 1 1
0 1 0 0 0
1 0 0 0 1
1 0 0 1 0
1 0 1 0 1
A now has the property that it will be a pseudo-random symmetric array in GF(2), such that it is known to be of full rank.
The inverse is easy enough to compute, using an elimination scheme.
Ainv =
1 0 0 1 1
0 1 0 0 0
0 0 1 0 1
1 0 0 0 1
1 0 1 1 1
mod(A*Ainv,2)
ans =
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
My recommendation is you should write the code to compute that inverse, if that is your goal. I'll attach a code that does so, but if you were to submit it as your homework, my bet is your teacher would see through it. So, for anyone who wants to compare my solution in GF(N) to yours, I've attached rrefgf.m to this answer.

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!