qrunch.quantum.algorithms.pauli.vqes.brute_force_gate_selector

Module for implementing a brute force gate selector.

Classes

BruteForceGateSelector

Implementation of a gate selector that try all gates and then select the one that returns the lowest energy.

class BruteForceGateSelector

Bases: GateSelector

Implementation of a gate selector that try all gates and then select the one that returns the lowest energy.

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

Initialize the BruteForceGateSelector.

Parameters:
  • estimator (Estimator) – Estimator to use for estimating the observable.

  • minimizer (Minimizer) – The minimizer to use in the algorithm.

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

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: int | float | complex | Expression[PauliOperators] | HermitianPauliSum, circuit: Circuit, initial_guess: dict[Parameter, float] | None = None, *, number_of_gates: int = 1) list[GatePoolOperator]

Select random gates from the gate pool.

Parameters:
  • observable (int | float | complex | Expression[PauliOperators] | HermitianPauliSum) – The observable whose expectation value should be minimized.

  • circuit (Circuit) – The circuit to extend with a gate form the gate pool.

  • initial_guess (dict[Parameter, float] | None) – Dict specifying the initial value of each Parameter. If None is given initial guess is 0.0.

  • number_of_gates (int) – Number of gates to select. Only implemented for number_of_gates = 1.

Returns:

List of gate pool operators.

Return type:

list[GatePoolOperator]