classmethod galois.FieldArray.Identity(size: int, dtype: DTypeLike | None = None) Self

Creates an \(n \times n\) identity matrix.

Parameters:
size: int

The size \(n\) along one dimension of the identity matrix.

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:

A 2-D identity matrix with shape (size, size).

Examples

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

In [2]: GF.Identity(4)
Out[2]: 
GF([[1, 0, 0, 0],
    [0, 1, 0, 0],
    [0, 0, 1, 0],
    [0, 0, 0, 1]], order=31)