qiskit.algorithms.VQE.get_energy_evaluation¶
- VQE.get_energy_evaluation(operator, return_expectation=False)[ソース]¶
Returns a function handle to evaluates the energy at given parameters for the ansatz.
This is the objective function to be passed to the optimizer that is used for evaluation.
- パラメータ
operator (OperatorBase) – The operator whose energy to evaluate.
return_expectation (bool) – If True, return the
ExpectationBase
expectation converter used in the construction of the expectation value. Useful e.g. to evaluate other operators with the same expectation value converter.
- 戻り値
Energy of the hamiltonian of each parameter, and, optionally, the expectation converter.
- 例外
RuntimeError – If the circuit is not parameterized (i.e. has 0 free parameters).
- 戻り値の型
Callable[[np.ndarray], float | list[float]] | tuple[Callable[[np.ndarray], float | list[float]], ExpectationBase]