qleap.Swap¶
- class qleap.Swap(q1, q2, control=None)¶
Swap is a class that represents the Swap gate operation in the QLeap framework.
The Swap gate switches the state of 2 qubits. For example, it maps \(|01\rangle\) to math:|10rangle and vice versa. An optional control qubit makes this a controlled swap gate, which will only perform the operation if the control is in the state \(|1\rangle\).
- __init__(q1, q2, control=None)¶
Creates a Swap instance that represents a Swap gate operation with the two given qubits. If an optional control qubit is given, this becomes a controlld swap gate.
- Parameters:
- Raises:
ValueError – If q1, q2, or the control argument contain more than one qubit.
Methods
__init__(q1, q2[, control])Creates a Swap instance that represents a Swap gate operation with the two given qubits.