Quantum Computing Asked on December 8, 2020
I’m trying to wrap my head around the expectation argument in Qiskit’s VQE
class, so to understand it I’m trying to create an ExpectationBase object to understand it better, but I’m getting nowhere. Can anyone give a hand?
The VQE computes the expectation values of the input operator with respect to the parameterized ansatz circuit. There are different ways to compute this expectation value, e.g. you could
The expectation
argument allows you to choose the kind of expectation computation you want to use.
qiskit.aqua.operators.MatrixExpectation
does the dot productqiskit.aqua.operators.PauliExpectation
does the Pauli string transform (this is what you would do on real quantum hardware)qiskit.aqua.operators.AerPauliExpectation
uses a special expectation value from Qiskit's Aer elementA bit more advanced:
If you were to create your own kind of expectation computation you can check how MatrixExpectation
or PauliExpectation
are implemented. They require some knowledge of how the operator flow in Aqua works though. In brief, the ExpectationValue
provides a convert
method that maps an operator expression that realizes the expectation value (something like OperatorMeasurement @ StateFn
) to a new expression that implements your expectation value scheme. For MatrixExpectation
this means converting all operators to matrices and for PauliExpectation
this means converting the operator to Pauli strings and applying the right basis transformations to the ansatz circuit.
Correct answer by Cryoris on December 8, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP