mimiqcircuits.operations.amplitude¶
Amplitude operation.
Classes
|
Record the amplitude of a computational basis state. |
- class Amplitude(bs)[source]¶
Bases:
OperationRecord the amplitude of a computational basis state.
Amplitude(bs)reads the complex amplitude of the basis statebsin the current quantum state and stores it in a z-variable. It does not change the state. The instruction takes only the target z-variable.- Parameters:
bs (BitString) – The basis state whose amplitude is recorded.
See also
BitString,ExpectationValueExamples
>>> from mimiqcircuits import * >>> c = Circuit() >>> # prepare a Bell state >>> c.push(GateH(), 0) 1-qubit circuit with 1 instruction: └── H @ q[0] >>> c.push(GateCX(), 0, 1) 2-qubit circuit with 2 instructions: ├── H @ q[0] └── CX @ q[0], q[1] >>> # store the amplitude of |11> in z-variable 0 >>> c.push(Amplitude(BitString("11")), 0) 2-qubit, 1-zvar circuit with 3 instructions: ├── H @ q[0] ├── CX @ q[0], q[1] └── Amplitude(bs"11") @ z[0]
- property zregsizes¶
Size of each z-variable register, with one entry per register.
Empty or
Nonewhen the operation has no z-variable register. Read-only: assigning to it raisesValueError.
- iswrapper()[source]¶
Whether the operation wraps another operation.
Truefor composite operations such asControl,Power,Inverse,ParallelorIfStatement,Falseotherwise.- Returns:
bool
- inverse()[source]¶
Not supported.
- Raises:
NotImplementedError – Always.