# gfsub

Subtract polynomials over Galois field

## Syntax

`c = gfsub(a,b,p) `

c = gfsub(a,b,p,len)

c = gfsub(a,b,field)

## Description

**Note**

This function performs computations in GF(p^{m}),
where p is prime. To work in GF(2^{m}), apply
the `-`

operator to Galois arrays of equal size.
For details, see Example: Addition and Subtraction.

`c = gfsub(a,b,p) `

calculates `a`

minus `b`

,
where `a`

and `b`

represent polynomials
over GF(`p`

) and `p`

is a prime
number. `a`

, `b`

, and `c`

are
row vectors that give the coefficients of the corresponding polynomials
in order of ascending powers. Each coefficient is between 0 and `p`

-1.
If `a`

and `b`

are matrices of the
same size, the function treats each row independently. Alternatively, `a`

and `b`

can
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
of length `len`

. The output `c`

is
a truncated or extended representation of the answer. If the row vector
corresponding to the answer has fewer than `len`

entries
(including zeros), extra zeros are added at the end; if it has more
than `len`

entries, entries from the end are removed.

`c = gfsub(a,b,field) `

calculates `a`

minus `b`

,
where `a`

and `b`

are the exponential
format of two elements of GF(p^{m}), relative
to some primitive element of GF(p^{m}). p
is a prime number and m is a positive integer. `field`

is
the matrix listing all elements of GF(p^{m}),
arranged relative to the same primitive element. `c`

is
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 `a`

and `b`

are
matrices of the same size, the function treats each element independently.

## Examples

## Version History

**Introduced before R2006a**