how to use a variable in finite field

sym a;
I want y=gf(3,8)*a, but it did not work.

댓글 수: 4

% Create a Galois field array
g = gf(3, 8);
disp('Galois field array:');
Galois field array:
disp(g);
gf with properties: x: 3 m: 8 prim_poly: 285
% Multiply the Galois field array by an integer
y = g * 2;
disp('Result after multiplication:');
Result after multiplication:
disp(y);
gf with properties: x: 6 m: 8 prim_poly: 285
ling
ling 2024년 4월 6일
Thank you! y=g*2, where 2 is a constant. Indeed, I require that y=g*a, where a is variable.
In my recent research, I need to reconstruct a polynomial using Lagrange interpolation in Galois field. During reconstruction, x is a variable and it is not incompatible with gf. Thus, I do know how to reconstruct a polynomial using Lagrange interpolation in Galois field.
ling
ling 2024년 4월 6일
The polynomial can be easily reconstructed using Lagrange interpolation in GF(p),where p is a primer.
Yeah

댓글을 달려면 로그인하십시오.

답변 (2개)

John D'Errico
John D'Errico 2024년 4월 6일
편집: John D'Errico 2024년 4월 6일

0 개 추천

g = gf(3, 8)
g = GF(2^8) array. Primitive polynomial = D^8+D^4+D^3+D^2+1 (285 decimal) Array elements = 3
whos g
Name Size Bytes Class Attributes g 1x1 92 gf
g is a gf object. But g is not compatible for multiplication by a symbolic parameter. These are two independent (and unfortunately, incompatible) toolboxes. They don't talk to or with each other. This is why when you do try to multiply g with a symbolic object, it fails.
syms a
g*a
Error using gf
Expected input x to be one of these types:

double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64

Instead its type was sym.

Error in gf (line 191)
validateattributes(x,{'numeric'}, {'integer', ...

Error in gf>areCompatible (line 1481)
if ~isa(b,'gf'), b=gf(b,a.m,a.prim_poly); return; end

Error in * (line 931)
[x,y]=areCompatible(x,y,'mtimes');
As the error message says, the only things you can multiply a gf object by are in that list of numeric classes. A sym is not one of the allowed classes for that operation.
You could possibly write your own set of tools that would work as you wish, essentially rewriting the gf class. Since a sym can take on any value, and it MUST be discrete for that operation to make any sense at all, it might take some work on your part to do so in a valid way.
Paul
Paul 2024년 4월 6일

0 개 추천

How about something along these lines?
y = @(a) gf(3,8)*a;
y(1)
ans = GF(2^8) array. Primitive polynomial = D^8+D^4+D^3+D^2+1 (285 decimal) Array elements = 3
y(2)
ans = GF(2^8) array. Primitive polynomial = D^8+D^4+D^3+D^2+1 (285 decimal) Array elements = 6

카테고리

도움말 센터File Exchange에서 Error Detection and Correction에 대해 자세히 알아보기

태그

질문:

2024년 4월 6일

답변:

2024년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by