2
$\begingroup$

If I act a CNOT gate on quantum circuit:

from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2)
qc.cx(0, 1)

it means that qubit_0 is the control qubit, and qubit_1 is the target qubit. And if I switch 0 and 1, it means that qubit_1 is the control qubit, and qubit_0 is the target qubit.

But I remember that the CNOT gate is a one-direction gate, which means that one of the case would be the same as the other one but with some hadamard gates acting before and after it on the real device.

So, what I would like to ask is that:
"How can I specify which is the one that would not act other gates when executing on the real device."

I had also checked for the coupling_map:

backend.configuration().coupling_map

and it returns both [0, 1] and [1, 0]

I'm not sure which is the one that won't act other hadamard gates, or is the real devices of IBMQ now support both kinds of CNOT operation?

Or, (I'm guessing) the smaller index would be the control qubit?

$\endgroup$
  • $\begingroup$ Hello! I don't think I really understand your question, could you add an example to show what you mean? $\endgroup$ – met927 Dec 3 at 9:15
  • $\begingroup$ Hi! You can maybe rephrase your question to make it clearer. I understood it as "I do not want additional H gates in my circuit, how can I know the 'hardware orientation', i.e. the natural way of performing a CNOT in the hardware". In addition to this, could you provide information on the backend you used? The double connectivity (presence of [0,1] and [1,0] in the coupling map) is not present on Melbourne, but is present in essex for example. $\endgroup$ – Nelimee Dec 3 at 10:11
  • $\begingroup$ @Nelimee thanks for your comment. The backend I tested is not an open device. $\endgroup$ – Huang Yi Te Dec 3 at 12:34
2
$\begingroup$

What you are asking here is a valid question, but it does depend on what backend you are using. The CNOT gate, when implemented on real hardware, is generally only implementable in one direction betweem any two pair of qubits, especially for transmon qubits (i.e. the types of qubits IBM uses).

However, simulators and emulators generally do not hold this constraint. Moreover, general quantum computing on a higher abstraction level also benefits from being able to apply these entangling gates in both directions.

To this end, one can indeed reverse the direction of a CNOT gate by change both qubits to the Hadamard basis before application of the CNOT gate, and back from the Hadamard basis to the computational basis after the application of the CNOT gate. It is a good exercise to assert this for yourself; a straightforward way to check this is by writing out the matrix multiplications that form this operation.

The coupling map that you have obtained does indicate that you have either used a simulator backend, or that you have used a physical backend where these bi-directional CNOT gates are possible. After checking the updated IBM Q website, I just realized that there are now indeed physical backends that do posses these gates. They are indicated by bi-directional arrows between the qubits (i.e. circles) if you click on the backends to show the diagrams.

$\endgroup$
  • $\begingroup$ Hi! Thanks for your answer. The coupling_map I checked are some real devices. But for the device diagrams, I do found out that there is a device which does not have bi-directional arrows between qubits. $\endgroup$ – Huang Yi Te Dec 3 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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