dq.cnot
cnot() -> QArray
Returns the \(\text{CNOT}\) gate.
It is defined by $$ \text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix} $$
Returns
(qarray of shape (4, 4)) \(\text{CNOT}\) gate.
Examples
>>> dq.cnot()
QArray: shape=(4, 4), dims=(2, 2), dtype=complex64, layout=dense
[[1.+0.j 0.+0.j 0.+0.j 0.+0.j]
[0.+0.j 1.+0.j 0.+0.j 0.+0.j]
[0.+0.j 0.+0.j 0.+0.j 1.+0.j]
[0.+0.j 0.+0.j 1.+0.j 0.+0.j]]