SwapGate¶
- class SwapGate(label=None)[source]¶
The SWAP gate.
This is a symmetric and Clifford gate.
Circuit symbol:
q_0: ─X─ │ q_1: ─X─
Matrix Representation:
\[\begin{split}SWAP = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}\end{split}\]The gate is equivalent to a state swap and is a classical logic gate.
\[|a, b\rangle \rightarrow |b, a\rangle\]Create new SWAP gate.
Attributes
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
Return definition in terms of other basic gates.
Return gate label
return instruction params.
Methods
SwapGate.add_decomposition
(decomposition)Add a decomposition of the instruction to the SessionEquivalenceLibrary.
Assemble a QasmQobjInstruction
SwapGate.broadcast_arguments
(qargs, cargs)Validation and handling of the arguments and its relationship.
SwapGate.c_if
(classical, val)Add classical condition on register classical and value val.
SwapGate.control
([num_ctrl_qubits, label, …])Return a (multi-)controlled-SWAP gate.
SwapGate.copy
([name])Copy of the instruction.
Return inverse Swap gate (itself).
Return True .IFF.
For a composite instruction, reverse the order of sub-gates.
SwapGate.power
(exponent)Creates a unitary gate as gate^exponent.
Return a default OpenQASM string for the instruction.
Creates an instruction with gate repeated n amount of times.
Return a numpy.array for the SWAP gate.