3

Starting from a state $|00\rangle|01\rangle|10\rangle$ (from $0$ to $n$ without repetitions), I want to reach an state in which all possible combinations of swaps are in a uniform superposition. I mean:

$\frac{1}{\sqrt{6}}(|00\rangle|01\rangle|10\rangle + |00\rangle|10\rangle|01\rangle + |01\rangle|00\rangle|10\rangle + |01\rangle|10\rangle|00\rangle + |10\rangle|00\rangle|01\rangle + |10\rangle|01\rangle|00\rangle)$

In fact, I want to do a general code with for any $n$ and not just $3$ as in the example above. I can do it for cases in which $n$ is a power of $2$ like $4, 8, 16,$ etc. using an ancilla. However, I can do the same for $n = 3$ because I got something like:

00-01-10: 0.125

00-10-01: 0.25

01-00-10: 0.125

01-10-00: 0.25

10-00-01: 0.125

10-01-00: 0.125

(two states are repeated so its probability is higher)

Egretta.Thula
  • 12,146
  • 1
  • 13
  • 35

1 Answers1

3

Appendix C in this paper provides an algorithm to do this based on a variant of the Fisher-Yates shuffle. The paper provides all the details you need to implement the algorithm in easy to follow steps.

Egretta.Thula
  • 12,146
  • 1
  • 13
  • 35