Subtract polynomials over Galois field
c = gfsub(a,b,p)
c = gfsub(a,b,p,len)
c = gfsub(a,b,field)
This function performs computations in GF(pm),
where p is prime. To work in GF(2m), apply
- operator to Galois arrays of equal size.
For details, see Example: Addition and Subtraction.
c = gfsub(a,b,p) calculates
b represent polynomials
p is a prime
row vectors that give the coefficients of the corresponding polynomials
in order of ascending powers. Each coefficient is between 0 and
b are matrices of the
same size, the function treats each row independently. Alternatively,
be represented as polynomial character vectors.
c = gfsub(a,b,p,len) subtracts
row vectors as in the syntax above, except that it returns a row vector
len. The output
a truncated or extended representation of the answer. If the row vector
corresponding to the answer has fewer than
(including zeros), extra zeros are added at the end; if it has more
len entries, entries from the end are removed.
c = gfsub(a,b,field) calculates
b are the exponential
format of two elements of GF(pm), relative
to some primitive element of GF(pm). p
is a prime number and m is a positive integer.
the matrix listing all elements of GF(pm),
arranged relative to the same primitive element.
the exponential format of the answer, relative to the same primitive
element. See Representing Elements of Galois Fields for an explanation
of these formats. If
matrices of the same size, the function treats each element independently.
Subtract Two GF Arrays
Calculate over GF(5).
x = gfsub([2 3 1],[4 2 3],5)
x = 1×3 3 1 3
Subtract the two polynomials and display the first two elements.
y = gfsub([2 3 1],[4 2 3],5,2)
y = 1×2 3 1
For prime number
p and exponent
m, create a matrix listing all elements of GF(p^m) given primitive polynomial .
p = 3; m = 2; primpoly = [2 2 1]; field = gftuple((-1:p^m-2)',primpoly,p);
Subtract from . The result is .
g = gfsub(2,4,field)
g = 7