qml.math.binary_finite_reduced_row_echelon

binary_finite_reduced_row_echelon(binary_matrix, inplace=False)[source]

Computes the reduced row echelon form (RREF) of a matrix with entries from the binary numbers, a.k.a. the finite field \(\mathbb{Z}_2\).

Parameters:
  • binary_matrix (array[int]) – binary matrix

  • inplace (bool) – Whether to perform the modification of binary_matrix in place. Defaults to False, making a copy before running the calculation.

Returns:

reduced row-echelon form of the given binary_matrix. The output has the same shape as the input. If inplace=True, the returned array is the same object as the input binary_matrix, which then has been modified in place.

Return type:

array[int]

Warning

This function is currently not compatible with JAX.

Example

>>> binary_matrix = np.array([[1, 0, 0, 0, 0, 1, 0, 0],
...                           [1, 0, 1, 0, 0, 0, 1, 0],
...                           [0, 0, 0, 1, 1, 0, 0, 1]])
>>> print(qml.math.binary_finite_reduced_row_echelon(binary_matrix))
[[1, 0, 0, 0, 0, 1, 0, 0],
 [0, 0, 1, 0, 0, 1, 1, 0],
 [0, 0, 0, 1, 1, 0, 0, 1]]