cirq_rigetti.quil_input.CSWAP

The Controlled Swap gate, also known as the Fredkin gate.

If the first qubit is |1⟩, this applies a SWAP between the second and third qubit, otherwise it acts as identity on the second and third qubit.

An instance of cirq.CSwapGate.

The unitary matrix of this gate is (empty elements are \(0\)):

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

Alternative names: cirq.FREDKIN.