Matrix of Galois Field Elements
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi There,
I need to solve Ax=b in an Galois Field environment and to my frustration I cannot get Matlab to do this simple task. My current problem is setting up the A matrix. Each element in the A Matrix = the exponentiation of an Galois field element( gf(GenRoots)) with a power, dictated by PolyPowers(Polynomial Powers).
K= 1 ;
n=255 ;
k=127;
for GenRoots = (1+K):(K+n-k)
A_Row = GenRoots - K ;
for PolyPowers = 1:128
A_Col = PolyPowers;
A(A_Row,A_Col) = (gf(GenRoots,4).^(PolyPowers+127))
end
end
I believe I'm buggering the syntax and just not suing the commands correctly but I cannot figure out what I am doing wrong.
The Matlab errors I get are:
??? The following error occurred converting from gf to double:
Error using ==> double
Conversion to double from gf is not possible.
Error in ==> test at 16
A(A_Row,A_Col) = (gf(GenRoots,4).^(PolyPowers+127))
How can I get an invertible matrix A, filled with galois field elements, after I have done some arithmetic with them?
Any help and comments will greatly be appreciated.
Thanks for your time,
Rudolf
0 Kommentare
Akzeptierte Antwort
Andrew Newell
am 12 Mai 2011
You must have a different version of MATLAB than I do (2010b). The error message I get is:
??? Error using ==> gf.gf at 66
X must be between 0 and 2^m-1
I get the same error message if I try this:
GenRoots = 16;
gf(GenRoots,4)
The solution is to use mod:
gf(mod(GenRoots,2^4),4)
EDIT: Similarly, in your loop you need
gf(mod(GenRoots,2^4),4).^(PolyPowers+127)
Note that I am creating the gf element first and then taking the power - with such large powers, you'll get an Inf otherwise!
EDIT 2: On my machine, this code does the same thing as your loop but 2000 times faster:
A1 = gf(repmat(mod((2:129)',2^4),1,128),4);
pp = repmat(1:128,128,1)+127;
A1 = A1.^pp;
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Error Detection and Correction finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!