qrunch.quantum.algorithms.pauli.vqes.analytical_beast_basic_vqe

Module containing adaptive orbital optimization VQE.

Classes

AnalyticalBeastBasicVqe

Analytical version of the BasicVqe.

class AnalyticalBeastBasicVqe

Bases: PauliBasicVqeAlgorithm

Analytical version of the BasicVqe.

Instead of having the minimizer call the estimator directly, the estimator is first called to make an analytical expression for the energy as a function of the gate parameter. This expression is then passed to the minimizer, requiring no more measurements.

Currently, only greedy Beast with the SymmetryAdaptedJordanWignerMapper is supported.

__init__(estimator: Estimator, minimizer: Minimizer, shots: int | None) None

Initiate an instance of the analytical basic vqe.

Parameters:
  • estimator (Estimator) – Estimator used to get expectation values.

  • minimizer (Minimizer) – Minimizer used for minimization of the operator.

  • shots (int | None) – Number of shots to use.

Return type:

None

clear_cache() None

Clear the cache of the underlying estimator.

Return type:

None

does_vqe_support_number_of_simultanously_parameters(number_of_parameters: int) bool

Check if the vqe supports the given number of parameters.

Parameters:

number_of_parameters (int) – The number of parameters to check.

Return type:

bool

run(observable: int | float | complex | Expression[PauliOperators] | HermitianPauliSum, circuit: Circuit, iteration: int | None = None, initial_guess: dict[Parameter, float] | None = None) VqeResult

Run the VQE algorithm.

The VQE algorithm finds optimal parameters for the circuit such that the expectation value of the observable is minimized.

The last gate is applied to the Hamiltonian to achieve the energy as a function of the parameter. For SingleExcitationGate’s this takes the form

\[E(t) = k_0 + k_1 \cos(t) + k_2 \sin(t) + k_3 \cos(2t) + k_4 \sin(2t)\]
Parameters:
  • observable (int | float | complex | Expression[PauliOperators] | HermitianPauliSum) – The observable whose expectation value should be minimized.

  • circuit (Circuit) – The parametrized circuit to find optimal parameters for. Should contain unspecified parameters.

  • iteration (int | None) – Unused.

  • initial_guess (dict[Parameter, float] | None) – Unused.

Return type:

VqeResult