qit.gate.swap

qit.gate.swap(d1, d2)

Swap gate.

Parameters
  • d1 (int) – subsystem 1 dimension

  • d2 (int) – subsystem 2 dimension

Returns

SWAP gate which swaps the order of two subsystems with dimensions [d1, d2].

Return type

Lmap

\[S: A_1 \otimes A_2 \to A_2 \otimes A_1, \quad \ket{x, y} \mapsto \ket{y, x}\]

Note

The actual subsystem order is swapped as well, not just the states of those subsystems. This is only important if d1 != d2.