qml.pauli.PauliGroupingStrategy¶

class
PauliGroupingStrategy
(observables, grouping_type='qwc', graph_colourer='lf')[source]¶ Bases:
object
Class for partitioning a list of Pauli words according to some binary symmetric relation.
Partitions are defined by the binary symmetric relation of interest, e.g., all Pauli words in a partition being mutually commuting. The partitioning is accomplished by formulating the list of Pauli words as a graph where nodes represent Pauli words and edges between nodes denotes that the two corresponding Pauli words satisfy the symmetric binary relation.
Obtaining the fewest number of partitions such that all Pauli terms within a partition mutually satisfy the binary relation can then be accomplished by finding a partition of the graph nodes such that each partition is a fully connected subgraph (a “clique”). The problem of finding the optimal partitioning, i.e., the fewest number of cliques, is the minimum clique cover (MCC) problem. The solution of MCC may be found by graph colouring on the complementary graph. Both MCC and graph colouring are NPHard, so heuristic graph colouring algorithms are employed to find approximate solutions in polynomial time.
 Parameters
observables (list[Operator]) – A list of Pauli words to be partitioned according to a grouping strategy.
grouping_type (str) – The binary relation used to define partitions of the Pauli words, can be
'qwc'
(qubitwise commuting),'commuting'
, or'anticommuting'
.graph_colourer (str) – The heuristic algorithm to employ for graph colouring, can be
'lf'
(Largest First),'rlf'
(Recursive Largest First),'dsatur'
(Degree of Saturation), or'gis'
(IndependentSet). Defaults to'lf'
.
 Raises
ValueError – If arguments specified for
grouping_type
orgraph_colourer
are not recognized.
See also
rustworkx.ColoringStrategy for more information on the
('lf', 'dsatur', 'gis')
strategies.Attributes
Adjacency matrix for the complement of the Pauli graph determined by the
grouping_type
.Binary Matrix corresponding to the symplectic representation of
self.observables
.Complement graph of the (anti)commutation graph constructed from the Pauli observables.

adj_matrix
¶ Adjacency matrix for the complement of the Pauli graph determined by the
grouping_type
.The adjacency matrix for an undirected graph of N nodes is an N x N symmetric binary matrix, where matrix elements of 1 denote an edge (grouping strategy is not satisfied), and matrix elements of 0 denote no edge (grouping strategy is satisfied).

binary_observables
¶ Binary Matrix corresponding to the symplectic representation of
self.observables
.It is an m x n matrix where each row is the symplectic (binary) representation of
self.observables
, withm = len(self.observables)
and n the number of qubits acted on by the observables.

complement_graph
¶ Complement graph of the (anti)commutation graph constructed from the Pauli observables.
Edge
(i,j)
is present in the graph ifobservable[i]
andobservable[j]
do not satisfy thegrouping_type
strategy.The nodes are the observables (can only be accesssed through their integer index).
Methods
binary_repr
([n_qubits, wire_map])Converts the list of Pauli words to a binary matrix, i.e. a matrix where row m is the symplectic representation of
self.observables[m]
.idx_partitions_from_graph
([observables_indices])Use
Rustworkx
graph colouring algorithms to partition the indices of the Pauli observables into tuples containing the indices of observables satisying the binary relation determined byself.grouping_type
.Partition the observables into groups of observables mutually satisfying the binary relation determined by
self.grouping_type
.Partition Pauli observables into lists of (anti)commuting observables using
Rustworkx
graph colouring algorithms based on binary relation determined byself.grouping_type
.
binary_repr
(n_qubits=None, wire_map=None)[source]¶ Converts the list of Pauli words to a binary matrix, i.e. a matrix where row m is the symplectic representation of
self.observables[m]
. Parameters
n_qubits (int) – number of qubits to specify dimension of binary vector representation
wire_map (dict) – dictionary containing all wire labels used in the Pauli word as keys, and unique integer labels as their values
 Returns
a column matrix of the Pauli words in binary vector representation
 Return type
array[int]

idx_partitions_from_graph
(observables_indices=None)[source]¶ Use
Rustworkx
graph colouring algorithms to partition the indices of the Pauli observables into tuples containing the indices of observables satisying the binary relation determined byself.grouping_type
. Parameters
observables_indices (Optional[TensorLike]) – A tensor or list of indices associated to each observable. This argument is helpful when the observables used in the graph colouring are part of a bigger set of observables. Defaults to None. If
None
, the partitions are made up of the relative indices, i.e. assumingself.observables
have indices in [0, len(observables)1]. Raises
IndexError – When
observables_indices
is not of the same length as the observables. Returns
Tuple of tuples containing the indices of the partitioned observables.
 Return type
tuple[tuple[int]]

partition_observables
()[source]¶ Partition the observables into groups of observables mutually satisfying the binary relation determined by
self.grouping_type
. Returns
List of partitions of the Pauli observables made up of mutually (anti)commuting observables.
 Return type
list[list[Operator]]

pauli_partitions_from_graph
()[source]¶ Partition Pauli observables into lists of (anti)commuting observables using
Rustworkx
graph colouring algorithms based on binary relation determined byself.grouping_type
. Returns
List of partitions of the Pauli observables made up of mutually (anti)commuting terms.
 Return type
list[list[Observable]]