Matrix of Galois Field Elements

5 次查看(过去 30 天)
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

采纳的回答

Andrew Newell
Andrew Newell 2011-5-12
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;
  1 个评论
Rudolf Hoehler
Rudolf Hoehler 2011-5-14
Thank you very much for the detailed reply! This helps a lot!
Regards,
Rudolf

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Error Detection and Correction 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by