qrunch.quantum.algorithms.pauli.vqes.adapt_gate_selector
Implementation of ADAPT-VQE (https://arxiv.org/pdf/1812.11173).
The core logic that defines the ADAPT-specific behavior is defined in the ADAPTGateSelector, and the class for running the ADAPT-VQE algorithm is just a class that calls the AdaptiveVqe class with the ADAPTGateSelector and some standard options.
Classes
Implementation of the |
|
Builder of an ADAPT gate selector. |
- class AdaptGateSelector
Bases:
GateSelectorImplementation of the
GateSelectorfor ADAPT-VQE.This gate selector uses the gate parameter gradient as the importance metric and does not perform any modifications on the gate pool.
Using this in the AdaptiveVQE results in an implementation of the ADAPT-VQE algorithm.
- __init__(estimator: Estimator, shots: int | None) None
Initialize the ADAPT GateSelector.
- Parameters:
estimator (Estimator)
shots (int | None)
- Return type:
None
- register_gate_pool(gate_pool: GatePool) None
Register the gate pool.
- Parameters:
gate_pool (GatePool) – the gate pool to register in the GateSelector. The GateSelector can only choose gates from this.
- Return type:
None
- select_gates(observable: HermitianPauliSum, circuit: Circuit, *, number_of_gates: int = 1) list[GatePoolOperator]
Select the best gates from the gate pool for minimizing the expectation value of the observable.
- Parameters:
observable (HermitianPauliSum) – The observable whose expectation value should be minimized.
circuit (Circuit) – The circuit to extend with a gate from the gate pool.
number_of_gates (int) – Number of gates to select.
- Returns:
The gate to append to the circuit.
- Return type:
list[GatePoolOperator]
- class AdaptGateSelectorCreator
Bases:
objectBuilder of an ADAPT gate selector.
- __init__() None
Initialize builder for the ADAPT gate selector.
- Return type:
None
- create() AdaptGateSelector
Create an instance of
AdaptGateSelector.- Return type:
- with_estimator(estimator: Estimator) Self
Set the estimator to use for the ADAPT gate selector.
- Parameters:
estimator (Estimator) – The estimator to use. Can be created using the
estimator_creator().- Return type:
Self
- with_shots(shots: int | None) Self
Set the number of shots to use in the ADAPT gate selector.
- Parameters:
shots (int | None) – Number of shots to use. If None, use exact sampling (requires an exact estimator like the excitation gate estimator).
- Return type:
Self