qrunch.quantum.algorithms.second_quantization.vqes.basic_vqe
Module containing basic VQE.
Classes
Basic VQE that takes a VQE as the underlying algorithm. |
|
Builder for the basic VQE algorithm. |
- class SecondQuantizationBasicVqe
Bases:
SecondQuantizationVqeAlgorithmBasic VQE that takes a VQE as the underlying algorithm.
- clear_cache() None
Clear the cache of the underlying VQE.
- Return type:
None
- run(second_quantized_operator: T, circuit: Circuit, initial_parameter_guess: dict[Parameter, float] | None = None) SecondQuantizationVqeResult[T]
Run the VQE and find the eigenvalue.
- Parameters:
second_quantized_operator (T) – The operator whose expectation value should be minimized.
circuit (Circuit) – The parametrized circuit to find optimal parameters for. Should contain unspecified parameters.
initial_parameter_guess (dict[Parameter, float] | None) – Dict specifying the initial value of each Parameter. If None is given initial
0.0 (guess is)
- Return type:
- class SecondQuantizationBasicVqeCreator
Bases:
VqeCreatorEstimatorMixin[BasicVqeCreator],VqeCreatorMinimizerMixin[BasicVqeCreator]Builder for the basic VQE algorithm.
- __init__() None
Initialize builder for the basic VQE.
- Return type:
None
- choose_minimizer() MinimizerSubCreator[Self]
Choose minimizer to use for the VQE.
- Return type:
MinimizerSubCreator[Self]
- create() SecondQuantizationBasicVqe
Create an instance of
SecondQuantizationBasicVqe.- Return type:
- with_estimator(estimator: Estimator) Self
Set the estimator to use for the VQE.
- Parameters:
estimator (Estimator) – Estimator to use. Can be created using the
estimator_creator()builder.- Return type:
Self
- with_estimator_shots(shots: int | None) Self
Set the number of shots to use in the estimator.
This is the number of shots that will be used in each call to the quantum computer or simulator, and not necessarily the total number of shots. The total number of shots will in many cases be much higher.
- Parameters:
shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact
simulator). ((e.g. the excitation gate)
- Return type:
Self
- with_total_estimator_shots(shots: int | None) Self
Set the total number of shots to use for each estimator call.
The total number of shots are then distributed across the different groups in the estimator according to the shots per group strategy of the estimator. This ensures better use of the shot budget, and therefore, better use of the quantum resources.
- Parameters:
shots (int | None) – Number of shots to use in the estimator. If None is given, the estimator is assumed to be exact
simulator). ((e.g. the excitation gate)
- Return type:
Self