classmethod galois.Poly.Like(poly_like: PolyLike, field: type[Array] | None = None) Self

Constructs a polynomial over \(\mathrm{GF}(p^m)\) from a PolyLike object.

Parameters:
poly_like: PolyLike

A poly-like object.

field: type[Array] | None = None

The Galois field \(\mathrm{GF}(p^m)\) the polynomial is over. The default is None which corresponds to GF2.

Returns:

The polynomial \(f(x)\).

Examples

Construct a polynomial over \(\mathrm{GF}(2)\) from a poly-like object.

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

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

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

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