Table of Contents
CSWAP gate (Fredkin)
CSWAP (also Fredkin or Controlled-SWAP) swaps two qubits if a third control qubit is $|1\rangle$. The quantum analog of a multiplexer and is universal for reversible classical computation.
Action: $|c ab\rangle \to |c (a' b')\rangle$ where $a' = c \cdot b + \bar{c} \cdot a$ and $b' = c \cdot a + \bar{c} \cdot b$ (conditional swap). If control is 0, qubits unchanged; if control is 1, qubits swap.
$$\text{CSWAP} = \text{Fredkin} = \begin{pmatrix} 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{pmatrix}$$
Basis action: swaps qubits 2 and 3 when qubit 1 is $|1\rangle$. Mapping: $|101\rangle \to |110\rangle$ and $|110\rangle \to |101\rangle$.
Properties
- Self-inverse: $\text{CSWAP}^2 = I$
- Universal: CSWAP alone is universal for reversible classical computation
- Symmetric: the two swapped qubits are treated identically
- Conservative: preserves Hamming weight (number of 1s in bitstring)
Relation to CCX
Both CCX (Toffoli) and CSWAP (Fredkin) are universal for classical reversible computation. They are dual in a sense: CCX flips, CSWAP swaps.
Uses
- Multiplexing: classical multiplexer logic implemented reversibly
- Quantum FFT: appears in some Fourier transform implementations
- Reversible circuits: designing reversible algorithms
- Conservation laws: CSWAP preserves Hamming weight (useful for systems with conservation laws)
Decomposition
- Gate cost: ~6+ CX gates + single-qubit gates (expensive like CCX)
- Structure: multiple CX layers and single-qubit rotations
Implementation
- Superconducting qubits: CX and single-qubit gate decomposition; gate time similar to CCX (expensive)
- Trapped ions: multi-step laser pulse sequence
- Photonic: post-selection or nonlinear schemes
- Availability: native CSWAP rare; decomposition typical
Comparison to SWAP
- Conditional vs unconditional: CSWAP conditional on control qubit (unlike SWAP)
- Cost trade-off: CSWAP more expensive than SWAP but enables reversible classical logic
Relations
- CCX: doubly-controlled X (Toffoli); dual to CSWAP
- SWAP: unconditional swap (two-qubit); CSWAP adds control
- Three-qubit gates: general category
