mqt.qecc.gf4¶
Utilities for additive linear algebra over GF(4).
GF(4) is the field with four elements, which has characteristic two: addition is
bitwise XOR, not integer arithmetic modulo four. The functions here mirror those
of mqt.qecc.mod2 for matrices whose entries encode GF(4) elements.
Functions¶
|
Convert a GF(4) matrix to row echelon form over GF(2). |
|
Compute the binary rank of a GF(2)-additive GF(4) matrix. |
|
Compute a basis for the additive row space of a GF(4) matrix. |
|
Multiply a GF(2) matrix by a GF(4) matrix. |
Module Contents¶
- row_echelon(matrix: numpy.typing.NDArray[integer], *, full: bool = False) tuple[numpy.typing.NDArray[integer], int][source]¶
Convert a GF(4) matrix to row echelon form over GF(2).
The input is assumed to be a dense integer matrix whose entries encode GF(4) elements as two-bit integers from zero to three. Since the considered codes are GF(2)-additive, row addition is bitwise XOR and pivots are selected independently for both binary components. The input is copied internally so the caller’s array is never modified.
- Parameters:
matrix – GF(4) matrix to reduce.
full – If
True, eliminate entries above and below each pivot (reduced row echelon form). Otherwise only eliminate below.
- Returns:
A tuple containing
the row echelon form,
the binary rank.
The order matches
mqt.qecc.mod2.row_echelon(), which additionally returns a transformation matrix and the pivot columns.
- rank(matrix: numpy.typing.NDArray[integer]) int[source]¶
Compute the binary rank of a GF(2)-additive GF(4) matrix.
- Parameters:
matrix – GF(4) matrix.
- Returns:
The binary rank of the matrix.
- row_basis(matrix: numpy.typing.NDArray[integer]) numpy.typing.NDArray[integer][source]¶
Compute a basis for the additive row space of a GF(4) matrix.
- Parameters:
matrix – GF(4) matrix.
- Returns:
A matrix whose rows form a basis of the additive row space.
- matmul_gf2(lhs: numpy.typing.NDArray[integer], rhs: numpy.typing.NDArray[integer]) numpy.typing.NDArray[integer][source]¶
Multiply a GF(2) matrix by a GF(4) matrix.
- Parameters:
lhs – Binary left-hand matrix.
rhs – Right-hand matrix whose entries encode elements of GF(4).
- Returns:
The matrix product using XOR for addition.
- Raises:
ValueError – If the inner matrix dimensions differ.