German
Sprachen
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.algorithms.VQD.get_energy_evaluation

VQD.get_energy_evaluation(step, operator, return_expectation=False, prev_states=None)[Quellcode]

Returns a function handle to evaluates the energy at given parameters for the ansatz.

This return value is the objective function to be passed to the optimizer for evaluation.

Parameter
  • step (int) – level of energy being calculated. 0 for ground, 1 for first excited state…

  • 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.

  • prev_states (list[np.ndarray] | None) – List of parameters from previous rounds of optimization.

Rückgabe

A callable that computes and returns the energy of the hamiltonian of each parameter, and, optionally, the expectation

Verursacht
  • RuntimeError – If the circuit is not parameterized (i.e. has 0 free parameters).

  • AlgorithmError – If operator was not provided.

Rückgabetyp

Callable[[np.ndarray], float | list[float]] | tuple[Callable[[np.ndarray], float | list[float]], ExpectationBase]