qiskit.algorithms.QAOA.construct_expectation¶
- QAOA.construct_expectation(parameter, operator, return_expectation=False)¶
Generate the ansatz circuit and expectation value measurement, and return their runnable composition.
- Parâmetros
parameter (
Union
[List
[float
],List
[Parameter
],ndarray
]) – Parameters for the ansatz circuit.operator (
OperatorBase
) – Qubit operator of the Observablereturn_expectation (
bool
) – If True, return theExpectationBase
expectation converter used in the construction of the expectation value. Useful e.g. to compute the standard deviation of the expectation value.
- Tipo de retorno
Union
[OperatorBase
,Tuple
[OperatorBase
,ExpectationBase
]]- Retorno
The Operator equalling the measurement of the ansatz
StateFn
by the Observable’s expectationStateFn
, and, optionally, the expectation converter.- Levanta
AlgorithmError – If no operator has been provided.
AlgorithmError – If no expectation is passed and None could be inferred via the ExpectationFactory.