qml.pauli.compute_partition_indices¶
-
compute_partition_indices
(observables, grouping_type='qwc', method='lf')[source]¶ Computes the partition indices of a list of observables using a specified grouping type and graph colouring method.
- Parameters
observables (list[Observable]) – A list of Pauli Observables to be partitioned.
grouping_type (str) – The type of binary relation between Pauli observables. Can be
'qwc'
,'commuting'
, or'anticommuting'
. Defaults to'qwc'
.method (str) – The graph colouring heuristic to use in solving minimum clique cover. Can be
'lf'
(Largest First),'dsatur'
(Degree of Saturation), or'gis'
(Greedy Independent Set). Defaults to'lf'
.
- Returns
A tuple of tuples where each inner tuple contains the indices of observables that are grouped together according to the specified grouping type and graph colouring method.
- Return type
tuple[tuple[int]]
See also
rustworkx.ColoringStrategy for more information on the
('lf', 'dsatur', 'gis')
strategies.Example
>>> observables = [qml.X(0) @ qml.Z(1), qml.Z(0), qml.X(1)] >>> compute_partition_indices(observables, grouping_type="qwc", method="lf") ((0,), (1, 2))