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[Operator]) – A list of Pauli operators to be partitioned.
grouping_type (str) – The type of binary relation between Pauli observables. It can be
'qwc','commuting', or'anticommuting'. Defaults to'qwc'.method (str) – The graph colouring heuristic to use in solving minimum clique cover. It can be
'lf'(Largest First),'rlf'(Recursive 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
>>> from pennylane.pauli import compute_partition_indices >>> 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))