Definition of all avalaible gates¶
In the following table, we list and give the definition of all available gates on the QLM.
$\forall \theta \in\rm I\!R$: $\begin{vmatrix} 1 & 0 \\ 0 & e^{i\theta} \\ \end{vmatrix}$ |
|||
|
|||
|
|||
$\forall \theta \in\rm I\!R$: $\begin{vmatrix} \cos(\frac{\theta}{2}) & -i\sin(\frac{\theta}{2}) ~\\ -i\sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) \\ \end{vmatrix}$ |
|||
$\forall \theta \in\rm I\!R$: $\begin{vmatrix} \cos(\frac{\theta}{2}) & -\sin(\frac{\theta}{2}) ~\\ \sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) \\ \end{vmatrix}$ |
|||
$\forall \theta \in\rm I\!R$: $\begin{vmatrix} e^{-i\frac{\theta}{2}} & 0 \\ 0 & e^{i\frac{\theta}{2}} \\ \end{vmatrix}$ |
|||
Short example¶
Here is a short example to illustrate the creation of a quantum program with all those gates:
In [1]:
from qat.lang.AQASM import Program, H, X, Y, Z, I, PH, S, T, RX, RY, RZ, CNOT, ISWAP, SQRTSWAP, CCNOT, SWAP
p = Program()
reg = p.qalloc(3)
p.apply(H, reg[0])
p.apply(X, reg[0])
p.apply(Y, reg[2])
p.apply(Z, reg[1])
p.apply(I, reg[1])
p.apply(S, reg[0])
p.apply(T, reg[0])
p.apply(PH(0.3), reg[0])
p.apply(RX(-0.3), reg[0])
p.apply(RY(0.6), reg[1])
p.apply(RZ(0.3), reg[0])
p.apply(CNOT, reg[0:2])
p.apply(SWAP, reg[0], reg[2])
p.apply(ISWAP, reg[1:3])
p.apply(SQRTSWAP, reg[0:2])
p.apply(CCNOT, reg)
circuit = p.to_circ()
circuit.display()
To learn more about how to write a quantum program with the Python AQASM library, check out this basic tutorial or this advanced tutorial
In [ ]: