qrunch.tools.minimizers.parameter_sorting_strategy.operator_commutativity_strategy

Parameter sorting strategy based on commutativity metrics with an operator.

Classes

OperatorCommutativitySortingStrategy

Order tail parameters by a commutativity-derived relevance metric.

class OperatorCommutativitySortingStrategy

Bases: ParameterSortingStrategy

Order tail parameters by a commutativity-derived relevance metric.

Given the tail subset of L symbolic gates (local indices 0..L-1), this strategy computes for each gate a heuristic score intended to capture how “relevant” the gate’s unitary generator is to the supplied Hermitian operator. Parameters are then sorted in descending order of this score with a stable tie-break (original tail order preserved when scores match).

For a gate with Hermitian generator \(G = \\sum_r a_r S_r\) and an operator \(O = \\sum_a c_a P_a\), the score is:

\[\begin{split}\\mathrm{score}(G, O) = \\sum_a |c_a| \\sum_{r : [S_r, P_a] \\neq 0} |a_r|^2.\end{split}\]

Thus only generator terms that anticommute with an operator term contribute, weighted by the operator coefficient magnitude and the squared generator coefficients.

__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 commutativity metric.

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:

ParameterSortingStrategyResult