matrices.cnot

CNOT matrix generates the CNOT operator matrix.

Functions

cnot()

Produce the CNOT matrix [1].

Module Contents

matrices.cnot.cnot()

Produce the CNOT matrix [1].

The CNOT matrix is defined as

\[\begin{split}\text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}.\end{split}\]

Examples

>>> from toqito.matrices import cnot
>>> cnot()
array([[1, 0, 0, 0],
       [0, 1, 0, 0],
       [0, 0, 0, 1],
       [0, 0, 1, 0]])

References

[1] (1,2)

Wikipedia. Controlled not gate. URL: https://en.wikipedia.org/wiki/Controlled_NOT_gate.

Returns:

The CNOT matrix.

Return type:

numpy.ndarray