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

Returns the polynomial coefficients in the order and size specified.

Parameters:
size: = 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.

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

Examples

In : GF = galois.GF(7)

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

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

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


Return the coefficients in ascending order.

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


Return the coefficients in ascending order with size 8.

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