필터 지우기
필터 지우기

Matrix of Galois Field Elements

조회 수: 5 (최근 30일)
Rudolf Hoehler
Rudolf Hoehler 2011년 5월 12일
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