# Indexing an "unknown" quantum state

Assuming I have a state $$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle$$ where $$|x_n\rangle$$ are quantum state vectors $$|x_n\rangle = \frac{1}{\|x_n\|}\sum_i x_{in}|i\rangle$$ and that I have a unitary $$U:|x_n\rangle \mapsto e^{2\pi i\theta_n}|x_n\rangle$$ such that I can use the phase estimation procedure to get the state $$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle|\theta_n\rangle$$

Question: I am wondering whether there is a way to compute the state $$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle|n\rangle$$ I was thinking to modify the Phase Estimation Algorithm, but I still find it difficult to understand if I can prepare a unitary $$U = \sum_n e^{2\pi in}|x_n\rangle\langle x_n|$$ for instance.
I am not insterested in ordering the vectors $$|x_n\rangle$$ in any way, I just wonder if there is a way to index them easily. I don't know if this problem has been raised before in literature and I don't know where to look at. I'd be glad if someone had some insights.

• Do you want to index the vectors $\{|x_n\rangle\}$ classically? If yes, then an orthonormal basis for the $n$-qubit space can be efficiently indexed using only $n$ classical bits. Consider labelling states of the form $|10111 \cdots 1\rangle$ with the classical bit string $10111 \cdots 1$? If not, can you clarify what you're looking for? Jun 20, 2020 at 0:45
• what are the $|\theta_n\rangle$ here?
– glS
Jun 21, 2020 at 9:48

The root of the issue here is how do you map between the values $$\theta_n$$ and $$n$$. A priori there is no way of doing this because the values $$n$$ are a completely abstract labelling. It wouldn't make any difference if I rearranged all the labels $$n$$.
So, you have defined the $$n$$s to be a particular order that you want. Presumably as part of that, you know how to identify, given a $$\theta_n$$, what the value of $$n$$ is. Whatever mental process that you go through to identify it, you need to translate that into a circuit which you would apply on the ancilla register.
Incidentally, are the coefficients $$x_{in}$$ known? If so, you should be able to construct a transformation directly rather than having to use phase estimation.