qrunch.tools.minimizers.parameter_sorting_strategy.descending_abs_value_strategy
Implements a parameter sorting strategy that sorts parameters by descending absolute value.
Classes
Sort tail parameters by descending absolute value. |
- class DescendingAbsoluteValueSortingStrategy
Bases:
ParameterSortingStrategySort tail parameters by descending absolute value.
Semantics
Given an
initial_guessof lengthL(values for the lastLsymbolic parameters of the circuit), the strategy:Collects those tail symbolic gates and re-bases their indices locally to
0..L-1.Orders the parameters by
-abs(value)using a stable sort so ties preserve original relative order within the tail.Returns the permuted parameter values and the associated permutation of local indices.
Characteristics
Ignores numeric-only gates entirely.
Stable: equal absolute values retain original input order.
Deterministic (no RNG usage).
Returns empty arrays if
L == 0.
- __init__(*args, **kwargs)
- sort_parameters(initial_guess: ndarray[Any, dtype[float64]], circuit: Circuit, operator: HermitianPauliSum | None) ParameterSortingStrategyResult
Sort the selected (tail) symbolic parameters by descending absolute value.
- Parameters:
initial_guess (ndarray[Any, dtype[float64]]) – The initial guess array of length \(L\).
circuit (Circuit) – The parameterized quantum circuit corresponding to \(|\psi(\theta)\rangle\).
operator (HermitianPauliSum | None) – The Hermitian operator \(O\) used to compute expectation values: \(\langle \psi(\theta) | O | \psi(\theta) \rangle\).
- Return type: