qecx.algebra.gf2_symplectic_inner_product

qecx.algebra.gf2_symplectic_inner_product(matrix, n)

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

For rows i, j with X-block / Z-block decomposition (a_i, b_i) and (a_j, b_j), the (i, j) entry is a_i . b_j + a_j . b_i (mod 2). Two Pauli operators commute iff their symplectic inner product is 0; the resulting matrix is therefore the F2 commutator table and is symmetric.

Parameters:
  • matrix (NDArray[np.uint8]) – Symplectic matrix of shape (m, 2n); X-block in columns [0, n) and Z-block in columns [n, 2n).

  • n (int) – Pauli-string length (equivalently, physical-qubit count).

Returns:

Freshly allocated array of shape (m, m). Returns the (0, 0) array when m == 0 and the (m, m) zero matrix when n == 0 (every row trivially commutes with every row in the absence of qubits).

Return type:

NDArray[np.uint8]