I would like to obtain a list of all stabilizer states in the given dimension (not necessarily qubit systems). What is an efficient way of generating this list numerically?

  • $\begingroup$ There is a question about how to generate 5-qubit stabilizer code, follow the link(quantumcomputing.stackexchange.com/questions/14264/…). $\endgroup$ Commented Nov 27, 2020 at 1:33
  • $\begingroup$ As Hilbert space vectors or projectors? $\endgroup$ Commented Nov 27, 2020 at 12:09
  • $\begingroup$ @MarkusHeinrich Either is fine, whichever is simpler would probably be best! $\endgroup$
    – Ver
    Commented Nov 27, 2020 at 12:12

1 Answer 1


First of all, keep in mind that there is no efficient way of generating them, simply because the number of stabiliser states increases super-exponentially with the number of qudits $n$ (like $p^{O(n^2)}$).

Second, I can only give you hints how to do it here, since a detailed treatise would take too long. Sorry. As far as I know, there is also no literature with details on implementation where I can point you to. I'm currently writing a tutorial on the stabiliser formalism which will contain more details and possibly even pseudo-code. But the pre-print will not be out before beginning of next year.

We consider stabiliser states in prime dimension $p$ (if you want prime-power, like e.g. for MUBs, that's similar). Define $\omega:=\exp(2\pi i /p)$ to be the standard choice of a primitive $p$-th root of unity.

State vector representation

For $p\neq 2$, the Hilbert space vectors representing stabiliser states can be chosen to be of the following form (Refs. [1,2]) $$ |K, q, b\rangle := \frac{1}{|K|} \sum_{x\in K} \omega^{q(x)+b\cdot x} |x\rangle, $$ where $K\subset\mathbb F_p^n$ is an affine subspace, $q$ is a quadratic form on $K$, and $b\in\mathbb F_p^n$.

For $p=2$, this is $$ |K, q, b \rangle := \frac{1}{|K|} \sum_{x\in K} i^{b\cdot x}\omega^{q(x)} |x\rangle, $$ i.e. the linear part is computed mod 4 instead of mod 2.

Now you can enumerate all stabiliser state by iterating over all possible affine subspaces $K$, and then over quadratic and linear forms on $K$. The later part is easy once you have fixed a basis of $K$.

Density matrix representation

The projectors of stabiliser states are determined by their stabiliser group $S$ as follows $$ P(S) = \frac{1}{p^n} \sum_{g\in S} g. $$ The stabiliser groups modulo signs correspond to so-called Lagrangian subspaces $L\subset \mathbb F_p^{2n}$ (see my answer here). These are $n$-dimensional linear subspaces such that the symplectic form of any two elements vanishes (Ref. [3]): $$ 0 = [v,w] := \sum_{i=1}^{n} v_i w_{n+i} - w_i v_{n+i}, \quad \forall v,w\in L. $$ Any vector $v\in L$ correspond to a Pauli/Weyl operator $W(v)$ and the above equation expresses that those should commute.

Now, for $p\neq 2$, we can rewrite the projector as $$ P(S) = P(L,h) = \frac{1}{p^n} \sum_{v\in L} \omega^{[h,v]} W(v). $$ From this representation, we can see that the coefficients of $P(L,h)$ in the Weyl basis (i.e. its Bloch vector) are given by $\omega^{[h,v]}$ if $v\in L$ and 0 otherwise. Hence, one can again iterate over Lagrangian subspaces $L$, and then over the vectors $h$. The latter part is again simplest in a basis of $L$. In the case $p\neq 2$, one can alternatively use the representation of stabiliser states by their Wigner functions.

For $p= 2$, this is a bit uglier. The coefficients here have the form $$ P(S) = P(L,h) = \frac{1}{2^n} \sum_{v\in L} (-1)^{\alpha(v)} W(v). $$ For a suitable function $\alpha$. To compute $\alpha$, one can fix it arbitrarily on a basis of $L$ (i.e. choose signs for the generators of $S$) and then compute the coefficients of all other elements from that using $$ \alpha(v+w) = \beta(v,w) - \alpha(v) - \alpha(w) $$ where $\beta$ is some horrible function determining whether you get an additional sign when you multiply two Pauli operators. Its explicit form is e.g. given in a paper of mine (Ref. [4, App. A])), but also elsewhere.


  1. Dehaene, Jeroen, and Bart De Moor. “The Clifford Group, Stabilizer States, and Linear and Quadratic Operations over GF(2).” Physical Review A 68, no. 4 (2003). https://doi.org/10.1103/PhysRevA.68.042318.
  2. Gross, D., and M. Van den Nest. “The LU-LC Conjecture, Diagonal Local Operations and Quadratic Forms over GF(2),” (2007). https://arxiv.org/abs/0707.4000v2.
  3. Gross, D. “Hudson’s Theorem for Finite-Dimensional Quantum Systems.” Journal of Mathematical Physics 47, no. 12 (2006): 122107. https://doi.org/10.1063/1.2393152.
  4. Heimendahl, Arne, Markus Heinrich, and David Gross. “The Axiomatic and the Operational Approaches to Resource Theories of Magic Do Not Coincide.” arXiv:2011.11651 (2020). http://arxiv.org/abs/2011.11651.
  • $\begingroup$ Markus, did the preprint you were mentioning ever get released? $\endgroup$ Commented Aug 10, 2022 at 0:47
  • 1
    $\begingroup$ @AmirEbrahimi Hi Amir, thanks for asking. Things took a different turn and the preprint has been transformed into the first chapter of my thesis kups.ub.uni-koeln.de/50465 . However, the focus there was not to write a tutorial but a mathematical treatise. So it's not easy reading (I know that a couple of students have found it useful nevertheless). There are still plans to make this more accessible and write something like a tutorial but IDK when this will be ready. $\endgroup$ Commented Aug 10, 2022 at 7:32
  • $\begingroup$ Thanks. At the very least I can review the first chapter of your thesis. $\endgroup$ Commented Aug 11, 2022 at 1:52
  • $\begingroup$ @AmirEbrahimi Sorry I meant first part not chapter $\endgroup$ Commented Aug 11, 2022 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.