classmethod galois.Poly.Degrees(degrees: Sequence[int] | ndarray, coeffs: ArrayLike | None = None, field: type[Array] | None = None) Self

Constructs a polynomial over \(\mathrm{GF}(p^m)\) from its non-zero degrees.

Parameters:
degrees: Sequence[int] | ndarray

The polynomial degrees with non-zero coefficients.

coeffs: ArrayLike | None = None

The corresponding non-zero polynomial coefficients. The default is None which corresponds to all ones.

field: type[Array] | None = None

The Galois field \(\mathrm{GF}(p^m)\) the polynomial is over.

  • None (default): If the coefficients are an Array, they won’t be modified. If the coefficients are not explicitly in a Galois field, they are assumed to be from \(\mathrm{GF}(2)\) and are converted using galois.GF2(coeffs).

  • Array subclass: The coefficients are explicitly converted to this Galois field using field(coeffs).

Returns:

The polynomial \(f(x)\).

Examples

Construct a polynomial over \(\mathrm{GF}(2)\) by specifying the degrees with non-zero coefficients.

In [1]: galois.Poly.Degrees([3, 1, 0])
Out[1]: Poly(x^3 + x + 1, GF(2))

Construct a polynomial over \(\mathrm{GF}(3^5)\) by specifying the degrees with non-zero coefficients and their coefficient values.

In [2]: GF = galois.GF(3**5)

In [3]: galois.Poly.Degrees([3, 1, 0], coeffs=[214, 73, 185], field=GF)
Out[3]: Poly(214x^3 + 73x + 185, GF(3^5))