mimiqcircuits.operations.gates.standard.swap¶
SWAP gate.
Classes
|
Two qubit SWAP gate. |
- class mimiqcircuits.operations.gates.standard.swap.GateSWAP[source]¶
Bases:
GateTwo qubit SWAP gate.
See Also
GateISWAP()Matrix representation:
\[\begin{split}\operatorname{SWAP} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}\end{split}\]Examples
>>> from mimiqcircuits import * >>> GateSWAP() SWAP >>> GateSWAP().matrix() [1.0, 0, 0, 0] [0, 0, 1.0, 0] [0, 1.0, 0, 0] [0, 0, 0, 1.0] >>> c = Circuit().push(GateSWAP(), 0, 1) >>> GateSWAP().power(2), GateSWAP().inverse() (⨷ ² ID, SWAP) >>> GateSWAP().decompose() 2-qubit circuit with 3 instructions: ├── CX @ q[0], q[1] ├── CX @ q[1], q[0] └── CX @ q[0], q[1]
- inverse()[source]¶
Raise an error, as non-unitary operators cannot be inverted.
This method is not implemented for non-unitary operators and will raise a NotImplementedError if called.
- Raises:
NotImplementedError – If the method is called.