<< Polynomials over GF(p) Polynomials over GF(p) gf_poly_divide >>

Galois Fields >> Galois Fields > Polynomials over GF(p) > gf_poly_add

gf_poly_add

Adds polynomials over GF(p)

Syntax

c = gf_poly_add(a, b, p)

Arguments

a, b

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³. The two polynomials can have different lengths.

p

Prime number: the characteristic of the field.

c

Result as a row of coefficients, constant term first, trimmed to its degree (no trailing zeros). The zero polynomial is returned as 0.

Description

gf_poly_add(a, b, p) computes a + b, adding coefficients of equal degree modulo p.

Examples

gf_poly_add([1 1 0 1], [0 1 1], 2)   // [1 0 1 1]
gf_poly_add([1 1 1], [1 1 1], 2)     // 0

See also

History

VersionDescription
2.0.0

Refactoring of the function/toolbox. Operands of different lengths are accepted and the result is trimmed.


Report an issue
<< Polynomials over GF(p) Polynomials over GF(p) gf_poly_divide >>