quantum gate directory
Fredkin
Symbol
$\mathrm{CSWAP}$
Description:
Controlled swap of two target qubits conditioned on a single control qubit.
Alternate notations:
- $\mathrm{CSWAP}$
- $\text{Fredkin}$
- $\text{controlled-}SWAP$
SDK Support
| SDK | Name |
|---|---|
| Qiskit |
qiskit.circuit.library.CSwapGate
|
| PennyLane |
pennylane.CSWAP
|
| Cirq |
cirq.CSWAP
|
| Q# | — |
| PyQuil | — |
| Braket | — |
| BQSKit | — |
The Fredkin (CSWAP) gate swaps the two target qubits when the control qubit is in the $|1\rangle$ state, and acts as identity when the control is $|0\rangle$.
$$ \mathrm{CSWAP} = \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 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \end{bmatrix} $$
Properties
- Self-inverse and Hermitian: $\mathrm{CSWAP}^\dagger = \mathrm{CSWAP}$.
- Classical reversible and conservative; it preserves Hamming weight in the computational basis.
- Can be decomposed into CNOT and Toffoli gates or into a small set of two-qubit gates.
Usage
- Conditional routing and permutation of qubits in a circuit.
- Reversible classical logic and quantum algorithms that require controlled swaps.
Back to home