1
$\begingroup$

I am relatively new to quantum computing I am confused with different notations for measurement gates in quantum computing as shown below https://arxiv.org/pdf/2205.00081 enter image description here

I really donot understand what exactly it means by zero after measurement gate? Also, how can output be retrived in a quantum circuit without a measurement gate? It would be great if someone can explain them using qiskit.

$\endgroup$

1 Answer 1

2
$\begingroup$

Typically, single-line wires are usually reserved for qubits, whereas double-line wires are used for classical bits.

When you perform a projective measurement on a quantum state, the measurement apparatus produces a readout that gives you information of the final configuration of such state. In gate-based quantum computing, this result is typically abstracted in the form of classical bits which are "stored" in a classical register denoted by double-line wires.

Here's a simple example:

enter image description here After the $H$ gate, the state is in an equal superposition of $|0\rangle$ and $|1\rangle$. After the measurement, the state of the qubit is projected onto either state $|0\rangle$ or state $|1\rangle$, each with $50\%$ probability. That state will remain in the qubit line for further operations if needed (assuming non-demolition measurements). The measurement apparatus will also produce a classical readout of $0$ or $1$ that will be "stored" in a classical register, denoted by the double lines (running downwards of the measurement gate in this example).

It is important to keep in mind that this is an abstraction, and that physically the measurement result corresponds to some measurable quantity associated with the eigenvalue of some physical observable (that we then assign the bit value of $0$ or $1$).

Now, to answer your questions:

  1. The $0$s "coming out" of the double-lined wire in your circuit simply means that the top two qubits are to be measured, and that only when they give a result of $0$ you are to consider what happens with the bottom qubit. This is known as post-selection.

  2. You simply cannot "retrieve" an output in a quantum circuit without performing a measurement. Can you elaborate on what makes you think you can?

  3. Here's a code example in qiskit where you post-select the output of a bottom qubit if the result in the top qubit is $0$:

from math import pi
from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator

simulator = AerSimulator()

qc = QuantumCircuit(2,1)
qc.ry(9*pi/10,1)
qc.cx(1,0)
qc.h(0)
qc.measure(1,0)              # measure q1
qc.save_density_matrix([0])  # save state of q0

meas_0 = False
n_runs = 0

# execute while loop until result in q1 is 0
while not meas_0:
    
    # get measurement result for q1
    result = simulator.run(qc,shots=1,memory=True).result()
    c1 = result.get_memory()

    n_runs += 1
    # if measure a 0, break while loop
    if c1[0] == '0':
        meas_0 = True

# convert DM of q0 to SV
ρ0 = result.data().get('density_matrix')
ψ0 = ρ0.to_statevector()

print(f'after {n_runs} attempts, a 0 was measured in q1 giving the post-selected state in q0 of:')
display(ψ0)

running this code results in the output: after 29 attempts, a 0 was measured in q1 giving the post-selected state in q0 of: $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$

$\endgroup$
10
  • $\begingroup$ Thank you @diemilio for the great help. Can you provide the link or the code of some similar example using qiskit. Without the code, quantum computing is somewhat very very difficult to understand for me. $\endgroup$
    – Manu
    Commented Jun 25 at 3:20
  • $\begingroup$ Sure. Can you be a bit more specific about what exactly are you looking for? A similar example to the one you have above? How similar and similar in which ways? $\endgroup$
    – diemilio
    Commented Jun 25 at 10:29
  • $\begingroup$ Thank you for the response @diemilio. I was reading the paper arxiv.org/pdf/2205.00081. This paper uses some gray codes to get a quantum circuit using some controlled Ry and controlled Rz gates. But in these kind of problems, I really could not understand what to measured at the end. Do we have to measure all the qubits or some particular (because in figure they are putting measurement gates only on some qubit). Reading this paper, I am realizing that there is huge knowledge gap. So, trying to understand the basics related to circuits of controlled Ry and Rz gates and measurement. $\endgroup$
    – Manu
    Commented Jun 25 at 18:14
  • $\begingroup$ If you direct me to some book or website link, that would also be great help @diemilio $\endgroup$
    – Manu
    Commented Jun 25 at 18:23
  • $\begingroup$ Sorry @Manu, but this second question you are asking is way to general. I would have to read the whole paper to understand what you mean. If you can pin down exactly where your confusion is, maybe I can help. I believe the answer I provided above does answer your original question, so please mark it as answered. Otherwise, please let me know specifically in which way it needs to be modified to answer your doubts. $\endgroup$
    – diemilio
    Commented Jun 25 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.