Communications Toolbox | ![]() ![]() |
Arithmetic in Extension Fields
The same arithmetic functions can add elements of GF(pm) when m > 1, but the format of the arguments is more complicated than in the case above. In general, arithmetic in extension fields is more complicated than arithmetic in prime fields; see the works listed in Selected Bibliography for Galois Fields for details about how the arithmetic operations work.
When working in extension fields, the functions gfadd
, gfmul
, gfsub
, and gfdiv
use the first two arguments to represent elements of GF(pm) in exponential format. The third argument, which is required, lists all elements of GF(pm) as described in List of All Elements of a Galois Field. The result is in exponential format.
Example: Addition Table for GF(9)
The code below constructs an addition table for GF(32), using exponential formats relative to a root of the default primitive polynomial for GF(9). If a
and b
are between -1 and 7, then the element gfpm_add(a+2,b+2)
represents the sum of Aa and Ab in GF(9). For example, gfpm_add(4,6) = 5
because
Using the fourth and sixth rows of the matrix field
, you can verify that
p = 3; m = 2; % Work in GF(3^2). field = gftuple([-1:p^m-2]',m,p); % Construct list of elements. row = -1:p^m-2; table = ones(p^m,1)*row; gfpm_add = gfadd(table,table',field) gfpm_add = -Inf 0 1 2 3 4 5 6 7 0 4 7 3 5 -Inf 2 1 6 1 7 5 0 4 6 -Inf 3 2 2 3 0 6 1 5 7 -Inf 4 3 5 4 1 7 2 6 0 -Inf 4 -Inf 6 5 2 0 3 7 1 5 2 -Inf 7 6 3 1 4 0 6 1 3 -Inf 0 7 4 2 5 7 6 2 4 -Inf 1 0 5 3
Other values of p
and m
produce tables for different prime fields GF(p
m
). Replacing gfadd
by gfmul
, gfsub
, or gfdiv
produces a table for the corresponding arithmetic operation in GF(p
m
).
![]() | Arithmetic in Galois Fields | Polynomials over Prime Fields | ![]() |