## Fast way to check if two state vectors are equivalent up to Pauli operations

8

1

I'm looking for fast code, or a fast algorithm, for checking if a given state vector $$A$$ can be transformed into another state vector $$B$$ using only the Pauli operations $$X$$, $$Y$$, $$Z$$.

The naive strategy is to simply iterate through all $$4^n$$ ways to apply a Pauli operation (or no operation) to each of the $$n$$ qubits, actually simulate applying the operations ($$2^n$$ cost for each qubit for each case) to one of the states, and check if the resulting state vector is equivalent to the other state. Surely it's possible to do this in better than worst case $$n 8^n$$ time?

[Update] I am specifically interested in worst case performance. Heuristics are interesting and useful answers, but won't become the accepted answer.

2

The way that I thought to start was to look at the reduced density matrices of the individual qubits. If they cannot be interconverted using Pauli matrices, then the whole thing can't.

The only problem is that this idea breaks down as soon any of the reduced density matrices are maximally mixed. At that point, you could ask "are the two states equivalent under local unitaries?". If you derive the unitaries as a result of that question, then it's easy to test if they're Pauli or not. This was studied here. I think there are still cases where the scaling is problematic, but I don't remember the bit with maximally mixed reduced density matrices well enough.

2That's a good heuristic for states such as $|CCZ\rangle$, but common states such as graph states without any singleton nodes will not benefit from it. The idea does generalize to e.g. looking at the reduced density matrix of pairs or triplets of qubits. – Craig Gidney – 2019-02-11T11:54:49.297

1

I agree. Of course, for graph states there have been a lot of studies about local Clifford equivalence, but then you have to start talking about how the states are specified. The trickiness of distinguishing between local Clifford and local Unitary equivalence is suggestive of how nasty the problem could be in general.

– DaftWullie – 2019-02-11T12:10:27.923

2

Pick an element $$a_i$$ of A and find its position in B, disregarding changes in phase. The shift in position uniquely identifies the series of $$X$$ or $$Y$$ applications needed for the transformation.

The relative phase of $$(a_0, b_0)$$ tells you, in steps of $$-i$$ rotations, how many $$Y$$ gates you need for the transformation. The relative phase of $$(a_1,b_1)$$ to $$(a_0,b_0)$$ tells you have many $$Y$$ or $$Z$$ gates act on the first qubit; and so on for the relative phase of $$(a_{2^{k-1}},b_{2^{k-1}})$$ to $$(a_0,b_0)$$ for $$Y$$ or $$Z$$ gates acting on qubit $$k$$.

If $$a_i$$ does not appear in B then the transformation is not possible.

I believe the above can be done in $$O(n)$$-sh.

1What happens if the elements $a_i$ aren't unique? – DaftWullie – 2019-02-11T15:40:59.867

You take cases. In any case as the degeneracy of the elements increases the problem becomes more trivial. The (magnitudes of the) elements of A and B have to be balanced. – Eelvex – 2019-02-11T15:43:45.607

3But what about states like graph states where all elements have the same magnitude? The point I'm trying to make is that taking cases would lead to the same exponential blow up. Admittedly, your suggestion is very good for eliminating or solving a lot of simple cases. – DaftWullie – 2019-02-11T15:53:01.067

I'm not saying that I have covered all corner cases but If all elements have the same magnitude, you need zero $X$ gates and you proceed with the relative phase check. – Eelvex – 2019-02-11T15:58:08.183

This is another good heuristic for certain states. But I'm specifically looking for an algorithm with good worst-case performance. – Craig Gidney – 2019-02-11T19:12:47.293

@CraigGidney, I don't see how this is heuristic. Can you give an example of a state where you believe this would fare worse than O(poly(n)*logn)? – Eelvex – 2019-02-11T21:53:29.637

@Eelvex Graph states have no variation in magnitude, so your first step will fail to pair up the states correctly. Then it will attempt to solve for the Y/Z applications with the wrong pairing, find no solution, and return a false negative. – Craig Gidney – 2019-02-12T00:05:08.500

@CraigGidney, no, that's not how it works. The output of the first step says that you need zero $X$ gates in this case. Then you solve for Y/Z in $O(n)$ keeping in mind that you may be off by $\pm i$. This can not return a false negative since $X$ gates can be replaced by $-i, Y, Z$ combinations. – Eelvex – 2019-02-12T00:26:54.877

@CraigGidney, graph states are certainly not the worst case for this algorithm. – Eelvex – 2019-02-12T00:29:14.947

@Eelvex Could you give an example of this algorithm determining that $X^{\otimes 3} CCZ\rangle$ is equivalent to $|CCZ\rangle = \sum_{a,b,c \in {0, 1}} (-1)^{abc} |abc\rangle$? My reading of your instructions is that it would apply no Y gates because there are no imaginary relative phases, and then it would fail because you can't transform between the two states using only Zs. – Craig Gidney – 2019-02-12T00:46:00.913

@CraigGidney, yes perhaps my description of the algorithm is poor. I will update with an example and a better description later. – Eelvex – 2019-02-12T00:50:23.510