pygsti.tools.group

Encapsulates a group in terms of matrices and relations

Module Contents

Classes

MatrixGroup

Encapsulates a group where each element is represented by a matrix.

Functions

is_integer(x)

Check if x is an integer type.

construct_1q_clifford_group()

Returns the 1 qubit Clifford group as a MatrixGroup object

pygsti.tools.group.is_integer(x)

Check if x is an integer type.

Parameters

x (object) – Object to test.

Returns

bool

pygsti.tools.group.construct_1q_clifford_group()

Returns the 1 qubit Clifford group as a MatrixGroup object

Returns

MatrixGroup

class pygsti.tools.group.MatrixGroup(list_of_matrices, labels=None)

Bases: object

Encapsulates a group where each element is represented by a matrix.

Parameters
  • list_of_matrices (list) – A list of the group elements (should be 2d numpy arrays), and can be mdl.gate.values() for some Model mdl that forms a group.

  • labels (list, optional) – A label corresponding to each group element.

matrix(self, i)

Returns the matrix corresponding to index or label i

Parameters

i (int or other) – If an integer, an element index. Otherwise, an element label.

Returns

numpy array

inverse_matrix(self, i)

Returns the inverse of the matrix corresponding to index or label i

Parameters

i (int or other) – If an integer, an element index. Otherwise, an element label.

Returns

numpy array

inverse_index(self, i)

Returns the index/label corresponding to the inverse of index/label i

Parameters

i (int or str) – If an integer, an element index. Otherwise, an element label.

Returns

int or str – If i is an integer, returns the element’s index. Otherwise returns the element’s label.

product(self, indices)

Returns the index/label of corresponding to the product of a list or tuple of indices/labels.

Parameters

indices (iterable) – Specifies the sequence of group elements to include in the matrix product. If indices contains integers, they an interpreted as group element indices, and an integer is returned. Otherwise, indices is assumed to contain group element labels, and a label is returned.

Returns

int or str – If indices contains integers, returns the resulting element’s index. Otherwise returns the resulting element’s label.

__len__(self)

Returns the order of the group (the number of elements)