qecx.algebraΒΆ

GF(2) and symplectic algebra helpers: Pauli/symplectic conversions and binary linear algebra over F2, used by the code-data classes.

paulis_to_symplectic(paulis, n)

Encode a tuple of length-n Pauli products as an (m, 2n) symplectic matrix.

symplectic_to_paulis(matrix, n)

Decode an (m, 2n) symplectic matrix to a tuple of length-n Pauli products.

binary_rows_to_paulis(matrix, char)

Convert each binary row to a length-n Pauli product with char at 1-positions.

gf2_rref(matrix)

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

gf2_left_null_space(matrix)

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

gf2_solve_left(A, b)

Solve the left F2 linear system c @ A == b (mod 2) for the coefficient row c.

gf2_symplectic_inner_product(matrix, n)

Pairwise F2 symplectic inner products of the rows of a symplectic matrix.