Standard graduate textbook covering the single- and two-qubit gate definitions, matrix identities, and circuit primitives this record states.
doi.org/10.1017/cbo9780511976667 ↗SWAP gate
A routing primitive that exchanges two qubit states and makes hardware connectivity explicit.
Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.
SWAP belongs in a practical catalog because moving a state is often a compilation concern, not an algorithmic one.
Circuit & simulation
What this takes and returns
Takes2 qubitsWhat joins here
Takes a 2-qubit register and states no assumption about what is on it. That is the whole condition: anything returning 2 qubits can feed it.
16 entries meet this end. Named below.
Returns2 qubitsWhat joins here
Returns a 2-qubit register a next stage can take. This is the end that joins.
11 entries meet this end. Named below.
A unitary. The same register goes in and comes out, and this entry states no assumption about what is on it — which is what lets anything of the same width feed it. See all 29 →
How it works
SWAP exchanges the states of two qubits: for every computational basis input, exactly the check this record performs across all four inputs. As a matrix, in the basis, and . Algebraically SWAP decomposes into three CNOTs, , which is what a compiler emits when SWAP is not a native two-qubit interaction. SWAP does not create or destroy entanglement between the qubits it moves; it relocates existing correlations to different wires. In practice SWAP is a routing/connectivity primitive: transpilers insert it to move a logical qubit's state across a hardware coupling graph so a two-qubit gate can be applied between qubits that are not physically adjacent, at the cost of extra circuit depth.
Implementation
OPENQASM 3.0;
include "stdgates.inc";
qubit[2] q;
swap q[0], q[1];Quantum vs classical
Classical baseline
Use a classical state-vector or matrix simulation at the same width, precision, and measurement objective.
Quantum claim
The quantum record demonstrates a state or operator behavior; it does not make classical simulation or communication costs disappear.
How to compare
Compare fidelity, samples, gate depth, noise, memory, and the cost of preparing and reading the state.
Declared gaps
Nobody has reviewed this record for gaps yet.