2
$\begingroup$

In the qiskit example for QFT demonstration the ibm_q_bogota is used, it has the following layout:

enter image description here

in the same time the measurement circuit for QFT demonstration is:

enter image description here

For such a linear layout how is it possible to implement CPHASE gate between Q0 and Q2? According to the layout, there is no physical connection between them.

$\endgroup$

2 Answers 2

2
$\begingroup$

Just as a followup to ElenaPT's answer, the transpilation process involves replacing the gate specified with the circuit with (formally) equivalent ones that are easier, or at least possible, for the physical quantum computer to implement. For example, a naïve way—definitely not optimal!—to run the CZ between qubits q0 and q2 would be: SWAP(q0, q1), then CZ(q1, q2), then SWAP(q0, q1). Note that SWAP can be built from three CX gates.

Observe that this does nothing on to the abstract qubits of the circuit representation, but it or something like it is necessary for this physical QPU.

New contributor
hat_matrix is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
3
$\begingroup$

The short answer is that the circuit is transpiled before execution. If you look at the code cell where the circuit is executed in the Qiskit textbook example you mention, you will see that it does:

transpiled_qc = transpile(qc, backend, optimization_level=3)
job = backend.run(transpiled_qc, shots=shots)

If you print transpiled_qc, you will see that the qubits have been re-routed to match the topology of the chip. For more information on the transpilation process, you can check out the transpiler documentation.

New contributor
ElenaPT is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
1
  • $\begingroup$ ok, but physically we need to have those connections (Q0 and Q2) between the qubits, isn't it? $\endgroup$
    – Curious
    May 24 at 14:43

Your Answer

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

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