qecx.algebra.gf2_solve_left

qecx.algebra.gf2_solve_left(A, b)

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

Returns a length-m row vector c such that (c @ A) % 2 == b if one exists, or None when b lies outside rowspace(A). The choice between equivalent solutions (when A has a non-trivial left null space) is an implementation detail; callers needing a particular representative should compose with the null-space basis themselves.

Parameters:
Returns:

Freshly allocated length-m row vector c satisfying (c @ A) % 2 == b, or None if no such c exists. With n == 0 the equation c @ A == b holds trivially for any c and the all-zeros length-m vector is returned. With m == 0 the all-zeros vector of shape (0,) is returned when b is all zeros, else None.

Return type:

NDArray[np.uint8] | None