In https://arxiv.org/abs/quant-ph/0208112, the authors discuss a scheme to, given a discrete probability distribution $\mathbf p\equiv (p_i)_i$, under some assumptions on $\mathbf p$, prepare the superposition state $$|\psi(\mathbf p)\rangle = \sum_i \sqrt{p_i}|i\rangle.$$ To have a toy example in mind and concretise the discussion, say we want to prepare the two-qubit state $$\sum_{i=0}^3\sqrt{p_i}|i\rangle\equiv \sqrt{p_0}|00\rangle+\sqrt{p_1}|01\rangle +\sqrt{p_2}|10\rangle+ \sqrt{p_3}|11\rangle.$$ As also discussed in How does the induction step in the Grover-Rudolph scheme to prepare superpositions from probabilities work?, the gist of the scheme is to iteratively "refine" the superposition. In other words, you start from $|0\rangle$, evolve it to $\sqrt{p_0+p_1}|0\rangle+\sqrt{p_2+p_3}|1\rangle$, and then implement another evolution such that $$\sqrt{p_0+p_1}|0\rangle \to \sqrt{p_0}|00\rangle + \sqrt{p_1}|01\rangle, \\ \sqrt{p_2+p_3}|1\rangle \to \sqrt{p_2}|10\rangle + \sqrt{p_3}|11\rangle.$$ To implement these evolutions, the authors propose a two-step procedure:
- Evolve $|0\rangle$ to $|0\rangle|\theta_0\rangle$ for some suitably defined $\theta_0$. This you can do as long as computing $\theta_0$ is efficient classically.
- Use $\theta_0$ as a control to perform a rotation on another ancillary qubit. Suitably choosing $\theta_0$, you can thus way implement the evolution $$|0\rangle|\theta_0\rangle\to |0\rangle|\theta_0\rangle\frac{\sqrt{p_0}|0\rangle+\sqrt{p_1}|1\rangle}{\sqrt{p_0+p_1}}.$$
The same procedure is applied separately to $|1\rangle$, resulting in $$|1\rangle|\theta_1\rangle\to |1\rangle|\theta_1\rangle\frac{\sqrt{p_2}|0\rangle+\sqrt{p_3}|1\rangle}{\sqrt{p_2+p_3}}.$$ Overall, this process gives us the evolution $$\sqrt{p_0+p_1}|0\rangle+\sqrt{p_2+p_3}|1\rangle \to |0\rangle|\theta_0\rangle(\sqrt{p_0}|0\rangle+\sqrt{p_1}|1\rangle) + |1\rangle|\theta_1\rangle(\sqrt{p_2}|0\rangle+\sqrt{p_3}|1\rangle).$$ That's almost the target superposition, except for the lingering ancillary qubits $|\theta_i\rangle$, which are however entangled with the rest of the qubits and therefore cannot just be ignored.
The authors just write that "we uncompute the register containing $|\theta_i\rangle$ to leave us with the desired state. How does this computation step work precisely, and what's its cost?
state-preparation
tag $\endgroup$