mimiqcircuits.operations.reset¶
Reset operations.
Classes
|
Reset a qubit to \(|0⟩\). |
|
Reset a qubit to \(|+⟩\). |
|
Reset a qubit to \(|{+i}⟩\). |
|
Reset a qubit to \(|0⟩\), an alias of |
- class Reset[source]¶
Bases:
krauschannelReset 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,powerandcontrolraiseTypeError.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.
Truefor composite operations such asControl,Power,Inverse,ParallelorIfStatement,Falseotherwise.- 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:
- Raises:
ValueError – If
normalizdoes not have length 2.
- class ResetX[source]¶
Bases:
krauschannelReset a qubit to \(|+⟩\).
Decomposes into a Hadamard gate, a
Resetand a second Hadamard gate: the reset puts the qubit in \(|0⟩\) and the last Hadamard turns it into \(|+⟩\).Warning
Not reversible:
inverse,powerandcontrolraiseTypeError.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.
Truefor composite operations such asControl,Power,Inverse,ParallelorIfStatement,Falseotherwise.- Returns:
bool
- class ResetY[source]¶
Bases:
krauschannelReset a qubit to \(|{+i}⟩\).
Decomposes into a
GateHYZ, aResetand a secondGateHYZ: the reset puts the qubit in \(|0⟩\) and the last gate turns it into \(|{+i}⟩\).Warning
Not reversible:
inverse,powerandcontrolraiseTypeError.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.
Truefor composite operations such asControl,Power,Inverse,ParallelorIfStatement,Falseotherwise.- Returns:
bool
- class ResetZ[source]¶
Bases:
krauschannelReset a qubit to \(|0⟩\), an alias of
Reset.ResetZ()returns aResetinstance.Examples
>>> from mimiqcircuits import * >>> c = Circuit() >>> c.push(ResetZ(), 0) 1-qubit circuit with 1 instruction: └── Reset @ q[0]