mimiqcircuits.operations.reset

Reset operations.

Classes

Reset()

Reset a qubit to \(|0⟩\).

ResetX()

Reset a qubit to \(|+⟩\).

ResetY()

Reset a qubit to \(|{+i}⟩\).

ResetZ()

Reset a qubit to \(|0⟩\), an alias of Reset.

class Reset[source]

Bases: krauschannel

Reset a qubit to \(|0⟩\).

Puts the qubit in \(|0⟩\) whatever its state, without recording an outcome. It is the Kraus channel with operators \(|0⟩⟨0|\) and \(|0⟩⟨1|\).

Warning

Not reversible: inverse, power and control raise TypeError.

See also

ResetX, ResetY, ResetZ, MeasureReset

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(Reset(), 0)
1-qubit circuit with 1 instruction:
└── Reset @ q[0]

Targets can be ranges, lists or tuples; one instruction is added per qubit:

>>> c = Circuit()
>>> c.push(Reset(),(0,1,2))
3-qubit circuit with 3 instructions:
├── Reset @ q[0]
├── Reset @ q[1]
└── Reset @ q[2]

>>> # the two Kraus operators: project on |0>, or move |1> to |0>
>>> Reset().krausoperators()
[P₀(1.0), SigmaMinus(1.0)]
inverse()[source]

Kraus channels have no inverse.

Raises:

NotImplementedError – Always.

power(pwr)[source]

Kraus channels cannot be raised to a power.

Raises:

NotImplementedError – Always.

iswrapper()[source]

Whether the operation wraps another operation.

True for composite operations such as Control, Power, Inverse, Parallel or IfStatement, False otherwise.

Returns:

bool

krausoperators(normaliz=None)[source]

Return the Kraus operators \(|0⟩⟨0|\) and \(|0⟩⟨1|\).

Parameters:

normaliz (list) – Two numbers; each operator is divided by the matching entry. Defaults to [1, 1].

Returns:

[Projector0(...), SigmaMinus(...)].

Return type:

list

Raises:

ValueError – If normaliz does not have length 2.

class ResetX[source]

Bases: krauschannel

Reset a qubit to \(|+⟩\).

Decomposes into a Hadamard gate, a Reset and a second Hadamard gate: the reset puts the qubit in \(|0⟩\) and the last Hadamard turns it into \(|+⟩\).

Warning

Not reversible: inverse, power and control raise TypeError.

See also

Reset, ResetY, ResetZ

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(ResetX(), 0)
1-qubit circuit with 1 instruction:
└── ResetX @ q[0]

>>> ResetX().decompose()
1-qubit circuit with 3 instructions:
├── H @ q[0]
├── Reset @ q[0]
└── H @ q[0]
inverse()[source]

Kraus channels have no inverse.

Raises:

NotImplementedError – Always.

power(pwr)[source]

Kraus channels cannot be raised to a power.

Raises:

NotImplementedError – Always.

iswrapper()[source]

Whether the operation wraps another operation.

True for composite operations such as Control, Power, Inverse, Parallel or IfStatement, False otherwise.

Returns:

bool

supports_canonical_rewrite()[source]

Whether CanonicalRewrite may decompose this operation.

Operations opt in: only those the canonical rewrite knows how to handle return True.

Returns:

bool

krausoperators()[source]

Return the two Kraus operators of the reset, as Operator.

class ResetY[source]

Bases: krauschannel

Reset a qubit to \(|{+i}⟩\).

Decomposes into a GateHYZ, a Reset and a second GateHYZ: the reset puts the qubit in \(|0⟩\) and the last gate turns it into \(|{+i}⟩\).

Warning

Not reversible: inverse, power and control raise TypeError.

See also

Reset, ResetX, ResetZ

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(ResetY(), 0)
1-qubit circuit with 1 instruction:
└── ResetY @ q[0]

>>> ResetY().decompose()
1-qubit circuit with 3 instructions:
├── HYZ @ q[0]
├── Reset @ q[0]
└── HYZ @ q[0]
inverse()[source]

Kraus channels have no inverse.

Raises:

NotImplementedError – Always.

power(pwr)[source]

Kraus channels cannot be raised to a power.

Raises:

NotImplementedError – Always.

iswrapper()[source]

Whether the operation wraps another operation.

True for composite operations such as Control, Power, Inverse, Parallel or IfStatement, False otherwise.

Returns:

bool

supports_canonical_rewrite()[source]

Whether CanonicalRewrite may decompose this operation.

Operations opt in: only those the canonical rewrite knows how to handle return True.

Returns:

bool

krausoperators()[source]

Return the two Kraus operators of the reset, as Operator.

class ResetZ[source]

Bases: krauschannel

Reset a qubit to \(|0⟩\), an alias of Reset.

ResetZ() returns a Reset instance.

See also

Reset, ResetX, ResetY

Examples

>>> from mimiqcircuits import *
>>> c = Circuit()
>>> c.push(ResetZ(), 0)
1-qubit circuit with 1 instruction:
└── Reset @ q[0]