# Algorithm to find stabilizer states

I'm working on a project in which I have to find stabilizer states based on a few criteria, the main one being that it has to have a certain amount of coherence, I'm using the following equation to calculate my coherence based on the density matrix of the state. $$C_r(\rho) = S_{VN}(\rho_{diag}) - S_{VN}(\rho)$$

Where S is the Von Neumann entropy and rho diag is the matrix with the main diagonal equal the density matrix's main diagonal, and every other term is zero. I'm also defining this to be a 5-qubit stabilizer state.

I'm using python and qutip to do these calculations.

Is there a better-than-brute-force algorithm to generate stabilizer states? Is there a way to generate stabilizer states at random based on some criteria?

• Coherence is a basis-dependent quantity, so can you please clarify what basis you're computing the coherence in? Is it the computational basis (obtained by the tensor products of local $\sigma_z$)? – keisuke.akira Jun 30 at 18:58
• I'm sorry. I'm computing the coherence in the computational basis. – Nillmer Jun 30 at 19:57
• I re-read your question and realised that I overlooked the last part. There are several different ways to generate or sample from stabiliser states. I have done that myself multiple times. Is it enough to have access to the density matrix (i.e. no amplitudes needed)? What are your "criteria"? – Markus Heinrich Jul 6 at 6:43
• Yes, having just the density matrix is enough, my criteria are just the ones stated in the question, the state must be formed by 5 qubits and have maximum coherence. – Nillmer Jul 16 at 17:21

Let's make a few observations first:

1. Since an $$N$$-qubit stabilizer state can be generated starting from $$| 0 \rangle^{\otimes N}$$ and applying H, CNOT, and S gates, we make the following observations. By simply applying the Hadamard on all qubits, one can generate the state $$| + \rangle^{\otimes N}$$ which is maximally coherent (under the free operations given by IO; see for example this review paper on quantum coherence). On the other hand, the initial state $$| 0 \rangle^{\otimes N}$$ has zero coherence (and entanglement). So, clearly, one needs to apply a few H, S gates to generate coherence (note that CNOT is an incoherent operation on multipartite coherence).

2. The number of stabilizer states for $$N$$-qubits is exponential (see this answer), a brute-force search would not be wise. Even for your $$5$$-qubit case, the number of states is $$\approx 2^{20}$$. However, since you want to use the relative entropy of coherence (and we're working in the pure state formalism), note that $$S(| \psi \rangle \langle \psi | ) = 0$$, so you only need to compute the first term, i.e., $$S(\mathcal{D}(| \psi \rangle \langle \psi | ))$$, where $$\mathcal{D}(\cdot)$$ is the dephasing superoperator (or the operator that dephases your state and makes it diagonal in the incoherent basis).

3. Moreover, the entries of $$\rho_{\mathrm{diag}}$$ are simply the inner products $$|\langle k | \psi \rangle|^2$$, where $$k$$ are the computational basis elements (which are also stabilizer states) and you can just compute these inner products efficiently (see #4), and then compute the von Neumann entropy of this probability distribution. In this case, the coherence essentially reduces to the spread of the state $$|\psi\rangle$$ in the computational basis.

4. Using Scott Aaronson's code (hopefully, you can find something more updated), one can efficiently compute inner products between two stabilizer states.

I would also recommend understanding the interplay between multipartite coherence and entanglement, for example, as initiated in this (now famous) paper.

Update: I would also recommend using QETLAB's function to compute relative entropy of coherence (or other measures) in case you don't have an efficient code.

As a supplement to the previous answer:

No need to compute inner products ... It is well known that any $$n$$-qubit stabiliser state is of the form $$|\psi\rangle = |K|^{-1/2} \sum_{x\in K} i^{d\cdot x} (-1)^{q(x)+b\cdot x} |x\rangle$$ where $$K\subset \mathbb{F}_2^{n}$$ is an affine subspace, $$b,d\in \mathbb{F}_2^{n}$$ are vectors and $$q$$ is a quadratic form (Dehaene and de Moor 2003). In particular, $$|\langle x | \psi \rangle|^2$$ is $$1/|K|$$ if $$x\in K$$ and 0 else. Thus, the von Neumann entropy is $$S(\rho_\mathrm{diag}) = \log |K| = \log 2^k = k \log 2$$ (where $$k=\dim K$$).