pygsti.tools.group.MatrixGroup#
- class MatrixGroup(list_of_matrices, labels=None)#
Bases:
objectEncapsulates 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.
Constructs a new MatrixGroup object
- 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.
Methods
__init__(list_of_matrices[, labels])Constructs a new MatrixGroup object
Returns the index/label corresponding to the inverse of index/label i
Returns the inverse of the matrix corresponding to index or label i
matrix(i)Returns the matrix corresponding to index or label i
product(indices)Returns the index/label of corresponding to the product of a list or tuple of indices/labels.
- inverse_index(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:
If i is an integer, returns the element’s index. Otherwise returns the element’s label.
- Return type:
int or str
- inverse_matrix(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.
- Return type:
numpy array
- matrix(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.
- Return type:
numpy array
- product(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:
If indices contains integers, returns the resulting element’s index. Otherwise returns the resulting element’s label.
- Return type:
int or str