qgates.gates¶
You can read more about logic gates here and quantum gates here.
-
qgates.gates.AND= array([[1, 1, 1, 0], [0, 0, 0, 1]])¶ 2x4 logical AND gate \(\begin{bmatrix} 1 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\)
-
qgates.gates.CNOT= array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])¶ 4x4 Quantum CNOT gate: \(\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix}\)
-
qgates.gates.COPY= array([[1, 0], [0, 0], [0, 0], [0, 1]])¶ 4x2 COPY gate \(\begin{bmatrix} 1 & 0 \\ 0 & 0 \\ 0 & 0 \\ 0 & 1 \end{bmatrix}\)
-
qgates.gates.HAD= array([[ 0.70710678, 0.70710678], [ 0.70710678, -0.70710678]])¶ 2x2 Quantum HADAMARD gate \(\begin{bmatrix} \frac{1}{\sqrt{2}} && \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} && \frac{-1}{\sqrt{2}} \end{bmatrix}\)
-
qgates.gates.IDEN= array([[1, 0], [0, 1]])¶ 2x2 identity gate \(\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)
-
qgates.gates.NAND= array([[0, 0, 0, 1], [1, 1, 1, 0]])¶ 2x4 logical NAND gate \(\begin{bmatrix} 0 & 0 & 0 & 1 \\ 1 & 1 & 1 & 0 \end{bmatrix}\)
-
qgates.gates.NOR= array([[0, 1, 1, 1], [1, 0, 0, 0]])¶ 2x4 logical NOR gate \(\begin{bmatrix} 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 \end{bmatrix}\)
-
qgates.gates.NOT= array([[0, 1], [1, 0]])¶ 2x2 logical NOT gate \(\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\)
-
qgates.gates.OR= array([[1, 0, 0, 0], [0, 1, 1, 1]])¶ 2x4 logical OR gate \(\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 1 & 1 \end{bmatrix}\)
-
qgates.gates.SWAP= array([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]])¶ 4x4 SWAP gate \(\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}\)
-
qgates.gates.TOFFOLI= array([[1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0]])¶ 8x8 Quantum TOFFOLI gate: \(\begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{bmatrix}\)
-
qgates.gates.XOR= array([[1, 0, 0, 1], [0, 1, 1, 0]])¶ 2x4 logical XOR gate \(\begin{bmatrix} 1 & 0 & 0 & 1 \\ 0 & 1 & 1 & 0 \end{bmatrix}\)