mimiqcircuits.operations.gates.standard.iswap

iSWAP and iSWAP† gates.

Classes

GateISWAP()

Two qubit iSWAP gate.

GateISWAPDG([operation])

Two qubit iSWAP† gate, the inverse of GateISWAP.

class GateISWAP[source]

Bases: Gate

Two qubit iSWAP gate.

Swaps the states of the two qubits and adds a phase \(i\) to \(|01\rangle\) and \(|10\rangle\).

Matrix Representation

\[\begin{split}\operatorname{ISWAP} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}\end{split}\]

Examples

>>> from mimiqcircuits import *
>>> GateISWAP()
ISWAP
>>> GateISWAP().matrix()
[1.0, 0, 0, 0]
[0, 0, 0.0 + 1.0*I, 0]
[0, 0.0 + 1.0*I, 0, 0]
[0, 0, 0, 1.0]

>>> c = Circuit().push(GateISWAP(), 0, 1)
>>> c
2-qubit circuit with 1 instruction:
└── ISWAP @ q[0:1]

>>> GateISWAP().power(2), GateISWAP().inverse()
(ISWAP**2, ISWAP†)
>>> GateISWAP().decompose()
2-qubit circuit with 6 instructions:
├── S @ q[0]
├── S @ q[1]
├── H @ q[0]
├── CX @ q[0], q[1]
├── CX @ q[1], q[0]
└── H @ q[1]

See also

GateISWAPDG, GateSWAP

inverse()[source]

Return the inverse of the gate.

Gates with a known inverse return it directly (for example GateS().inverse() is GateSDG()); otherwise the gate is wrapped in Inverse.

class GateISWAPDG(operation=None, *args, **kwargs)[source]

Bases: Inverse

Two qubit iSWAP† gate, the inverse of GateISWAP.

Matrix Representation

\[\begin{split}\operatorname{ISWAP}^\dagger = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & -i & 0 \\ 0 & -i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}\end{split}\]

Examples

>>> from mimiqcircuits import *
>>> GateISWAPDG()
ISWAP†
>>> GateISWAPDG().matrix()
[1.0, 0, 0, 0]
[0, 0, 6.12323399573677e-17 - 1.0*I, 0]
[0, 6.12323399573677e-17 - 1.0*I, 0, 0]
[0, 0, 0, 1.0]

>>> c = Circuit().push(GateISWAPDG(), 0, 1)
>>> c
2-qubit circuit with 1 instruction:
└── ISWAP† @ q[0:1]

>>> GateISWAPDG().power(2), GateISWAPDG().inverse()
(ISWAP†**2, ISWAP)
>>> GateISWAPDG().decompose()
2-qubit circuit with 6 instructions:
├── S† @ q[0]
├── S† @ q[1]
├── H @ q[0]
├── CX @ q[0], q[1]
├── CX @ q[1], q[0]
└── H @ q[1]

See also

GateISWAP, GateSWAP

__init__(operation=None)[source]

Initialize an ISWAP† gate. The argument is unused.

inverse()[source]

Return the wrapped gate, undoing the inversion.

isopalias()[source]

Whether the operation is a named alias of a wrapper.

Some named gates are defined as a wrapper around another operation, for example GateS as GateZ to the power 1/2. Such gates return True. Not every such gate reports it: GateSDG and GateCX return False.

Returns:

True for a named alias of a wrapper that reports it, False otherwise.

Return type:

bool