Learn more about our quantum error correction milestone

cirq.SWAP

The swap gate.

Used in the notebooks

Used in the tutorials

This gate will swap two qubits (in any basis).

The unitary matrix of this gate is:

\[ \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \]