Gate decomposition

Not all quantum devices can realize all quantum gates. In practice this is not an issue since any quantum gate can be constructed from a series of universal quantum gates provided the device can execute them. The downside is that the combination of gates takes longer to perform and hence introduces a higher error rate.

For example on spin-qubit devices the CNOT gate is not directly available. We can however realize this gate by a combination of single qubit rotations and a CZ gate. The following circuit is equivalent to a CNOT gate with qubit 0 as the control gate and qubit 1 as the target gate.

          version 1.0
qubits 2

Ry q[1], -1.57079632679
CZ q[0], q[1]
Ry q[1], 1.57079632679


To check that the circuit above and a CNOT gate are indeed equivalent, we can execute the following Python code:

          import numpy as np
import qutip
from qutip import basis, sigmaz, tensor, identity
cnot = qutip.cnot(N=2)
cz = qutip.controlled_gate(sigmaz() )

Y2=tensor(identity(2), qutip.ry(np.pi/2) )