# A question about how to store the quantum state in quantum circuit

Now I have five qubits quantum circuit like:

and as the circuit, first q[0], q[2] and q[3] pass the X gate, and then is that means they store in QRAM as a whole by the following quantum circuit? If so, in the next step, how could it possible to take q[3] and q[4] out from the "whole $$| \text{out} \rangle$$"?or actually, every time it takes the "whole $$| \text{out} \rangle$$" to the new step?

• Hi! What do you mean by "they store in QRAM as a whole by the following quantum circuit"? May 4 '20 at 8:46
• In classical circuit,it need a register to save the output from the last step, so compared with that, the quantum circuit is also doing the same thing I guess. If so ,it need something just like register in classical qubit to save the output status |10110>, and make it as an input to the next step. And I read a paper about QRAM said the procedure to save the status as I said is like the second circuit, which shows that it save the status of five qubits as a whole. so in the next step does it separate qubit 3 and 4 from the "whole |out>" or just take the "whole |out>"(|10110>)as an input? May 4 '20 at 8:55
• The state of the qubits is only read into classical memory with the measurement operations, and this cannot be done part way through the circuit as this would destroy the quantum state. I don't believe that QRAM is used anywhere yet, so the circuits you will see don't use it May 4 '20 at 9:30
• are you looking for storing normalized vectors (on the circuit)?
– Aman
May 21 '20 at 2:31

I am not sure if this will help to answer the question, but here are the detailed steps of the first circuit presented in the question:

$$X \otimes I \otimes X \otimes X \otimes I |00000\rangle = |10110\rangle$$

$$I \otimes I \otimes I \otimes CNOT^{3,4} |10110\rangle = |101\rangle \otimes CNOT^{3,4}|10\rangle = |10111\rangle$$

$$I \otimes I \otimes I \otimes CNOT^{4,3} |10111\rangle = |101\rangle \otimes CNOT^{4,3}|11\rangle = |10101\rangle$$

Here the indexes of the qubits start from $$0$$. Note that sometimes it is more convenient to drop the $$I$$ operators wherever it is possible. For example, the last step can be written in a shorter form:

$$CNOT^{4,3} |10111\rangle = |101\rangle \otimes CNOT^{4,3}|11\rangle = |10101\rangle$$

• actually in this quantum circuit I need to store the states |10110⟩ first, then let the |10110⟩ as an input to do the next step, right? and the next step only related to the qubit 3 and 4. By reading the paper about QRAM, I know the procedure to store the states is like the second circuit. So I mean in the next step, it will take the whole |10110>as an input or only |101>? May 4 '20 at 8:42
• In classical circuit, for example, it need a register to save the output from the last step, so compared with that, the quantum circuit is also doing the same thing I guess. but as the second circuit shows that it save the status of five qubits as a whole. so in the next step does it separate qubit 3 and 4 from the "whole |out>" or just take the "whole |out>"(|10110>)as an input? May 4 '20 at 8:47
• @Henry_Fordham, In my written steps I didn't assume any additional storing procedures. If I am applying $A$ and $B$ gates on the qubit, then the output of the $A$ gate will be the input for the $B$ gate in the quantum circuit. I haven't read the paper that you are referring to, so I can't help with that :) May 4 '20 at 8:56