quantum gate directory
SWAP
Symbol
$\mathrm{SWAP}$
Description:
Exchanges the quantum states of two qubits.
Alternate notations:
- $\mathrm{SWAP}$
- $\mathrm{SWAP}_{ij}$
SDK Support
| SDK | Name |
|---|---|
| Qiskit |
qiskit.circuit.library.SwapGate
|
| PennyLane |
pennylane.SWAP
|
| Cirq |
cirq.SWAP
|
| Q# | — |
| PyQuil | — |
| Braket | — |
| BQSKit | — |
Groups
This gate is contained in the following groups:
The SWAP gate exchanges the states of two qubits and is commonly used to reorder qubits or mediate interactions between distant qubits.
$$ \mathrm{SWAP} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} $$
Properties
- Reversible: the SWAP gate is its own inverse.
- Decomposition: $\mathrm{SWAP} = \mathrm{CNOT}_{12} \cdot \mathrm{CNOT}_{21} \cdot \mathrm{CNOT}_{12}$.
Back to home