I was working on error correction algebraically but I now want to use some computational method. I have a set of generators of a stabilizer group which I represent as a rectangular matrix over $\mathbb{F}_2$ in a standard way. More precisely, if $i$'th generator $S_i$ contains $Z$ acting on $j$'th qubit, $(i,j)$ entry is $1$. If it contains $X$ acting on $j$'th qubit, $(i,j)$ entry is $1$.
Now, I have an operator $L$ represented as a vector in the same way, I want to see if it's contained in the group.
I tried using Python numpy and galois to calculate the pseudo-inverse of the matrix at first, which didn't work because of this reason. https://math.stackexchange.com/questions/1612708/computing-one-sided-inverse-of-a-matrix-over-some-finite-field The main problem is, over a finite field, even though the rows of the matrix is linearly independent, $(A A^T)^{-1}$, which is used to calculate the pseudo-inverse, is not necessarily invertible.
Next thing I tried was to use numpy.linalg.lstsq
.
Although galois
claims that it supports combined use with numpy.linalg
, it doesn't give an approximated solution over $\mathbb{F}_2$.