qrunch.quantum.algorithms.pauli.vqes.basic_vqe
Implementation of the basic VQE algorithm.
Classes
Class for running a basic VQE. |
|
Builder for the basic VQE algorithm. |
- class BasicVqe
Bases:
objectClass for running a basic VQE.
- clear_cache() None
Clear the cache of the 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], circuit: Circuit, iteration: int | None = None, initial_guess: dict[Parameter, float] | None = None) VqeResult
- run(observable: 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.
- 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) – If applicable, the current adaptive iteration. If not applicable, set to None.
initial_guess (dict[Parameter, float] | None) – Dict specifying the initial value of each Parameter. If None is given initial guess is 0.0.
- Return type:
- class BasicVqeCreator
Bases:
objectBuilder for the basic VQE algorithm.
- __init__() None
Initialize builder for the basic VQE.
- Return type:
None
- choose_minimizer() MinimizerSubCreator[Self]
Chose minimizer to use for the VQE.
- Return type:
MinimizerSubCreator[Self]
- with_estimator(estimator: Estimator) Self
Choose estimator to use for the VQE.
- Parameters:
estimator (Estimator)
- Return type:
Self
- with_estimator_shots(shots: int | None) Self
Choose the number of shots to use in the estimator.
- Parameters:
shots (int | None)
- Return type:
Self