mimiqcircuits.operations.expectationvalue¶
Expectation value operation.
Classes
|
Operation to compute and store the expectation value of an Operator in a z-register. |
- class mimiqcircuits.operations.expectationvalue.ExpectationValue(op)[source]¶
Bases:
OperationOperation to compute and store the expectation value of an Operator in a z-register.
An expectation value for a pure state \(| \psi \rangle\) is defined as:
Expectation Value for Pure State
\[\langle O \rangle = \langle \psi | O | \psi \rangle\]where \(O\) is an operator. With respect to a density matrix \(\rho\), it’s given by:
Expectation Value for Density Matrix
\[\langle O \rangle = \mathrm{Tr}(\rho O).\]However, when using quantum trajectories to solve noisy circuits, the expectation value is computed with respect to the pure state of each trajectory.
The argument op can be any gate or non-unitary operator.
Note
ExpectationValue is currently restricted to one and two qubit operators.
See also
AbstractOperator,GateExamples
In push!, the first argument corresponds to the qubit, and the second to the z-register.
>>> from mimiqcircuits import * >>> ExpectationValue(GateX()) ⟨X⟩
>>> c = Circuit() >>> c.push(ExpectationValue(GateX()), 1, 1) 2-qubit, 2-zvar circuit with 1 instruction: └── ⟨X⟩ @ q[1], z[1]
>>> c.push(ExpectationValue(SigmaPlus()), 1, 2) 2-qubit, 3-zvar circuit with 2 instructions: ├── ⟨X⟩ @ q[1], z[1] └── ⟨SigmaPlus(1)⟩ @ q[1], z[2]
- property qregsizes¶
- property cregsizes¶
- property zregsizes¶