SWAP

pyquil.gates.SWAP(q1, q2)[source]

Produces a SWAP gate which swaps the state of two qubits:

SWAP = [[1, 0, 0, 0],
        [0, 0, 1, 0],
        [0, 1, 0, 0],
        [0, 0, 0, 1]]
Parameters:
  • q1 (Union[Qubit, QubitPlaceholder, int]) – Qubit 1.
  • q2 (Union[Qubit, QubitPlaceholder, int]) – Qubit 2.
Return type:

Gate

Returns:

A Gate object.