I have a very basic question: say I perform some set of operations on $$N$$ qubits (like QFT, QFT addition etc), and thus have a $$N$$ qubit final state.

If each qubit has something that I want to read off of it, is it possible to extract data from each qubit into classical?

I now know how to load classical data onto a quantum device, but how do I read the final data? Is it impossible to get it since the wavefunction collapses? What I mean to ask is whether there exists a general protocol to read final N qubits into N classical bits (even at least by repeated measurements (bounded by the Chernoff limit) or similar such methods).

• measurements involve irreversible loss of information, if that's what you are asking.
– glS
Feb 19 '20 at 13:26

It seems as if you have an algorithm that can prepare a state such as:

$$\frac{1}{\sqrt{2}}(\vert 0A\rangle+\vert 1B\rangle),$$

and you want to be able to extract $$A$$ and $$B$$ separately.

You are correct that if you measure the second register, you will "collapse" the state, and it may be difficult to distinguish $$A$$ and $$B$$.

However, you may still be able to determine whether $$A=B$$. For example, interference allows you to measure the first register in the Hadamard basis. If $$A=B$$ then after Hadamarding the first register must revert back to $$0$$.

• Yes, that is true. This is exactly what I am talking about. So, you seem to conclude that it wouldn't, in principle be possible to go from (|0A> + |0B>) to |AB> right? Feb 11 '20 at 23:14
• You can repeat the measurement and get a probability distribution. In case states $A$ and $B$ are orthogonal in some basis, you can distinguish them easily as one is mapped to $|0\rangle$ and second one to $|1\rangle$ after measurement (I assume that $A$ and $B$ are single qubit states). Otherwise, you have to employ quantum tomography to "scan" the states. Feb 12 '20 at 5:47

In Qiskit, to read the qubits into classical bits you can use the measure operation. If you have defined classical and quantum registers as cr and qr respectively, you can get the values of all the qubits by doing qc.measure(qr,cr)

• Hi, thanks for your response! Well, what I am looking for is something like : say I have a 2 qubit state such as |0A> + |1B> and I want to read both A and B into classical registers. Then if I measure the second qubit, system will collapse to A or B. Feb 11 '20 at 18:02
• Do you mean get the state vector out? This can be done using the statevector simulator. You load this in the same way as the qasm simulator  Aer.get_backend('statevector_simulator'). If you then want to get the counts, you should do this using a separate execution Feb 11 '20 at 19:32
• @met927 this seems to address classical simulation of a quantum algorithm, but not to the OP's question about reading out both $A$ and $B$ from a superposition of $\vert 0A\rangle+\vert 1B\rangle$. Feb 11 '20 at 20:43