galois.Poly.coefficients(size: int | None = None, order: 'desc' | 'asc' = 'desc') Array

Returns the polynomial coefficients in the order and size specified.

Parameters
size: int | None = None

The fixed size of the coefficient array. Zeros will be added for higher-order terms. This value must be at least degree + 1 or a ValueError will be raised. The default is None which corresponds to degree + 1.

order: 'desc' | 'asc' = 'desc'

The order of the coefficient degrees, either descending (default) or ascending.

Returns

An array of the polynomial coefficients with length size, either in descending order or ascending order.

Notes

This accessor is similar to the coeffs property, but it has more settings. By default, Poly.coeffs == Poly.coefficients().

Examples

In [1]: GF = galois.GF(7)

In [2]: f = galois.Poly([3, 0, 5, 2], field=GF); f
Out[2]: Poly(3x^3 + 5x + 2, GF(7))

In [3]: f.coeffs
Out[3]: GF([3, 0, 5, 2], order=7)

In [4]: f.coefficients()
Out[4]: GF([3, 0, 5, 2], order=7)

Return the coefficients in ascending order.

In [5]: f.coefficients(order="asc")
Out[5]: GF([2, 5, 0, 3], order=7)

Return the coefficients in ascending order with size 8.

In [6]: f.coefficients(8, order="asc")
Out[6]: GF([2, 5, 0, 3, 0, 0, 0, 0], order=7)