Subtracts elements of a finite field
c = gf_subtract(F, a, b)
A field created by gf_create_field.
Field elements.
In GF(p) (n = 1): a matrix of integers in 0 .. p-1, of any size.
In GF(p^n), n > 1: a matrix with n columns, one element per row. Each row holds the coefficients of a polynomial in α of degree < n, constant term first.
Coefficients outside 0 .. p-1 are rejected; reduce them first with gf_mod if needed.
The result, in the same form as the operands.
gf_subtract(F, a, b) computes a - b in the field F. Subtraction is done coefficient by coefficient, modulo p.
Both operands must contain the same number of elements, or one of them must be a single element; a single element is combined with each element of the other operand. The result has the shape of the operand that holds several elements (of a when both have the same number).
In characteristic 2, subtraction gives the same result as addition.
| Version | Description |
| 2.0.0 | Refactoring of the function/toolbox. Accepts several elements at once; invalid arguments raise errors. |