qecx.algebra.gf2_left_null_space

qecx.algebra.gf2_left_null_space(matrix)

Compute a row basis for the left null space of a binary matrix over F2.

The returned basis spans all vectors c of length m such that c @ matrix == 0 (mod 2). Basis rows are produced in the row order yielded by gf2_rref() on the augmented matrix [matrix | I_m].

Parameters:

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

Returns:

Freshly allocated array of shape (k, m) where k = m - rank(matrix). An input with zero rows or zero columns yields the m-by-m identity (every row is in the left null space when n == 0) or a (0, 0) array when m == 0.

Return type:

NDArray[np.uint8]