# Are all stabilizer codes real? Or example stabilizer codes with $\pm i$ coefficients

This is a follow-up question to

Stabilizer codes and 1,-1 coefficients

A lot of well known codes (5 qubit code, 7 qubit Steane code, 9 qubit Shor code) have logical zero and logical one which can be written as (a global scalar times) a linear combination of computational basis kets with only $$\pm 1$$ as coefficients.

The question linked above shows that any stabilizer code has codewords which can be written as (a global scalar times) a linear combination of computational basis kets where every coefficient is $$\pm 1, \pm i$$.

I'm curious about these $$\pm i$$ coefficients. Does anyone know any stabilizer codes which seem to use $$\pm i$$ in an essential way? In other words

What is an example of a stabilizer code which has codewords with some $$\pm i$$ coefficients and is not equivalent by local unitaries to a stabilizer code with just $$\pm 1$$ coefficients?

In general I'm interested in any examples of cool stabilizer codes that use $$\pm i$$ relative coefficients.

Note: Corollary 2 of Thm 9 in https://arxiv.org/abs/1711.07848 says some pretty cool stuff (although part (iv) of the corollary is wrong). In particular, part (iii) of Corollary 2 says that the number of $$\pm i$$ amplitudes is either 0 or it is half the number of non-zero amplitudes.

Every stabilizer code is equivalent by local Cliffords to a real stabilizer code.

To see why observe that the logical states of the code are exactly the elements of the code space that are simultaneous eigenvectors from the logical $$Z$$ type operator. By adding the logical $$Z$$ to the code stabilizer we can realize the logical states as stabilizer states. Every $$n$$ qubit stabilizer state is proportional to $$\sum_{u \in \mathbb{F}_2^k} i^{c^Ty} (-1)^{y^TQy} |y=Ru+t \rangle$$ for some vectors $$c,t \in \mathbb{F}_2^n$$ and symmetric $$n \times n$$ binary matrix $$Q$$ and $$n \times k$$ binary matrix $$R$$. This result is originally theorem 5 of

https://arxiv.org/pdf/quant-ph/0304125.pdf

but is given in a slightly more digestible form in the appendix of

https://arxiv.org/pdf/0811.0898.pdf

It is interesting to note that many stabilizer states are graph states (and even if a stabilizer state is not explicitly a graph state then it is still equivalent by local Clifford gates to a graph state, see how to go from a stabilizer state to a graph ) and for the case of a graph state the matrix $$Q$$ can be interpreted as the adjacency matrix of a a graph.

The relevant part of this equation is that a stabilizer state is either real (if $$c$$ is perpendicular to the affine space $$R(\mathbb{F}_2^k)+t$$ which is the support of the stabilizer state) or exactly half the support of the state has an imaginary coefficient (if $$c$$ is not perpendicular to the support). In the case that the stabilizer state is half imaginary then it can be converted to a real stabilizer state by a local Clifford. Indeed the imaginary half will be exactly the cofactor of $$|0>$$ or $$|1>$$ for some qubit. If it is a cofactor of $$|0>$$ then acting with $$XSX$$ on that one qubit will take the state to a real state. Similarly, if the imaginary half is a cofactor of $$|1>$$ then acting $$S$$ on that qubit will take the state to a real state.

• Did you write any code that does the conversion (from complex code to real code)? Is the conversion guaranteed to preserve distance? Nov 14, 2022 at 4:25
• I don't have any code. And yes the conversion will preserve distance because distance is preserved under local unitaries. This is mentioned on top of page 4 in Quantum Weight Enumerators which in turn refers to the discussion below equation (9) in the original paper Quantum MacWilliams Identities . The relevant fact here is that distance is determined by the weight enumerator and the weight enumerator is invariant with respect to local unitaries. Mar 20, 2023 at 13:33

In this paper https://arxiv.org/abs/quant-ph/9611001 (Theorem 5) the author shows that "any additive code is equivalent to a real additive code". So you can always find an equivalent code where where all stabilizers are real; the codespace will then be spanned by combinations with $$\pm 1$$ coefficients only (no $$\pm \imath$$ needed). I always work with real codes for that reason (that's why I use $$Y=XZ$$ convention). I did notice that the number of nonzero coefficients is always a power of 2; nice to see that paper prove it.

• Do you know what notion of equivalence is being used here? Aug 19, 2022 at 19:52
• I think of a code (whether classical or quantum) in terms of it being a group rather than any vector space it's acting on. A group can have different representations so the vector space and any basis of it will depend on the representation. However, as a group the parameters $n$,$k$,$d$ and weight enumerator $W$ are well defined independent of the representation. So my interpretation of "equivalence" here is that if you have a stabilizer code with parameters $n,k,d,W$, you can find a real stabilizer code with the same parameters. Just my view;may not be rigorous enough for what you're doing. Aug 19, 2022 at 20:48
• ok that seems like a pretty reasonable perspective. So what is the group that you are thinking of as the code? Is it just the stabilizer group? How about the classical case? Are you just thinking of an additive classical code as an elementary abelian 2-group/ binary vector space? Aug 19, 2022 at 22:51
• for classical case the code would be a subgroup of elementary abelian 2-group. For real stabilizer code, a subgroup of "extraspecial group" of order $2^{2n+1}$, this is a group that shows up in other areas so it's a nice bonus; for complex stabilizer code there's a slight modification to the extraspecial group by making its center have order 4 instead of 2. Aug 19, 2022 at 23:29
• In one of your comments here quantumcomputing.stackexchange.com/questions/12677/… you mention "Also any complex stabilizer code can be turned into a real version with the same distance...I had to do the conversion several times when checking published codes that are complex." Would you mind giving some of those examples? I would be very interested to see them. Oct 8, 2022 at 3:04