qecx.algebra.gf2_rref

qecx.algebra.gf2_rref(matrix)

Reduce a binary matrix to reduced row echelon form over F2.

Parameters:

matrix (NDArray[np.uint8]) – Input binary matrix of shape (m, n).

Returns:

A freshly allocated (m, n) array holding the reduced row echelon form, and the list of pivot-column indices in ascending order. An input with zero rows or zero columns yields a copy of the input and an empty pivot list.

Return type:

tuple[NDArray[np.uint8], list[int]]