The SWAP gate is two-qubit operation. Expressed in basis states, the SWAP gate swaps the state of the two qubits involved in the operation:
version 1.0
qubits 2
X q[0]
H q[1]
display # display state before swap operation
SWAP q[0], q[1]
display # display state after swap operation
q[0] | ||||
---|---|---|---|---|
q[1] |