galois.FieldArray.vector(dtype: DTypeLike | None = None) FieldArray

Converts an array over \(\mathrm{GF}(p^m)\) to length-\(m\) vectors over the prime subfield \(\mathrm{GF}(p)\).

This function is the inverse operation of the Vector() constructor. For an array with shape (n1, n2), the output shape is (n1, n2, m). By convention, the vectors are ordered from degree \(m-1\) to degree 0.

Parameters:
dtype: DTypeLike | None = None

The numpy.dtype of the array elements. The default is None which represents the smallest unsigned data type for this FieldArray subclass (the first element in dtypes).

Returns:

An array over \(\mathrm{GF}(p)\) with last dimension \(m\).

Examples

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

In [2]: a = GF([11, 7]); a
Out[2]: GF([11,  7], order=3^3)

In [3]: vec = a.vector(); vec
Out[3]: 
GF([[1, 0, 2],
    [0, 2, 1]], order=3)

In [4]: GF.Vector(vec)
Out[4]: GF([11,  7], order=3^3)
In [5]: GF = galois.GF(3**3, repr="poly")

In [6]: a = GF([11, 7]); a
Out[6]: GF([α^2 + 2,  2α + 1], order=3^3)

In [7]: vec = a.vector(); vec
Out[7]: 
GF([[1, 0, 2],
    [0, 2, 1]], order=3)

In [8]: GF.Vector(vec)
Out[8]: GF([α^2 + 2,  2α + 1], order=3^3)
In [9]: GF = galois.GF(3**3, repr="power")

In [10]: a = GF([11, 7]); a
Out[10]: GF([α^12, α^16], order=3^3)

In [11]: vec = a.vector(); vec
Out[11]: 
GF([[1, 0, 2],
    [0, 2, 1]], order=3)

In [12]: GF.Vector(vec)
Out[12]: GF([α^12, α^16], order=3^3)