The CNOT gate is two-qubit operation, where the first qubit is usually referred to as the control qubit and the second qubit as the target qubit. Expressed in basis states, the CNOT gate:
- leaves the control qubit unchanged and performs a Pauli-X gate on the target qubit when the control qubit is in state ;
- leaves the target qubit unchanged when the control qubit is in state .
Note: For multi-qubit gates, it must always be checked whether the topology (connectivity) allows for a direct implementation of the operation. A compilation step may be required in order to map an operation.
As an example, on the Starmon-5 backend q[0]
and q[1]
are not connected. An operation such as cnot q[0],q[1]
should therefore be rewritten as cnot q[0],q[2]
or compiled by inserting swap gates, when the intended operation is indeed a a cnot between q[0]
and q[1]
.