Class SWAPGate

java.lang.Object
com.quantum4j.core.gates.TwoQubitGate
com.quantum4j.core.gates.SWAPGate
All Implemented Interfaces:
Gate

public final class SWAPGate extends TwoQubitGate
SWAP quantum gate.

A two-qubit gate that exchanges the states of two qubits. The gate permutes basis states as: |00⟩ → |00⟩, |01⟩ → |10⟩, |10⟩ → |01⟩, |11⟩ → |11⟩. The SWAP gate matrix is:

 [1  0  0  0]
 [0  0  1  0]
 [0  1  0  0]
 [0  0  0  1]
 
  • Constructor Details

    • SWAPGate

      public SWAPGate()
  • Method Details

    • name

      public String name()
      Description copied from interface: Gate
      Get the name of this gate (e.g., "H", "X", "CNOT").
      Returns:
      the gate name