Division with remainder of polynomials over GF(p)
r = gf_poly_divide(a, b, p) [r, q] = gf_poly_divide(a, b, p)
Dividend. Polynomial over GF(p): a row vector of integer coefficients in 0 .. p-1, constant term first. For instance [1 0 1 1] is 1 + x² + x³.
Divisor, not zero. Same form as a; the two can have different lengths.
Prime number: the characteristic of the field.
Remainder, of degree lower than b. Result as a row of coefficients, constant term first, trimmed to its degree (no trailing zeros). The zero polynomial is returned as 0.
Quotient, in the same form as r.
gf_poly_divide(a, b, p) divides a by b over GF(p): it finds q and r such that a = q × b + r with deg r < deg b. The remainder is returned first; the quotient is the optional second output.
b does not need to be monic. An error is raised if b is the zero polynomial.
| Version | Description |
| 2.0.0 | Refactoring of the function/toolbox. |