pygsti.algorithms.grammatrix¶

Utility functions related to Gram matrix construction.

Module Contents¶

Functions¶

 max_gram_basis(op_labels, dataset, max_length=0) Compute a maximal set of basis circuits for a Gram matrix. max_gram_rank_and_eigenvalues(dataset, target_model, max_basis_string_length=10, fixed_lists=None) Compute the rank and singular values of a maximal Gram matrix.
pygsti.algorithms.grammatrix.max_gram_basis(op_labels, dataset, max_length=0)

Compute a maximal set of basis circuits for a Gram matrix.

That is, a maximal set of strings {S_i} such that the gate strings { S_i S_j } are all present in dataset. If max_length > 0, then restrict len(S_i) <= max_length.

Parameters
• op_labels (list or tuple) – the operation labels to use in Gram matrix basis strings

• dataset (DataSet) – the dataset to use when constructing the Gram matrix

• max_length (int, optional) – the maximum string length considered for Gram matrix basis elements. Defaults to 0 (no limit).

Returns

list of tuples – where each tuple contains operation labels and specifies a single circuit.

pygsti.algorithms.grammatrix.max_gram_rank_and_eigenvalues(dataset, target_model, max_basis_string_length=10, fixed_lists=None)

Compute the rank and singular values of a maximal Gram matrix.

That is, compute the rank and singular values of the Gram matrix computed using the basis: max_gram_basis(dataset.gate_labels(), dataset, max_basis_string_length).

Parameters
• dataset (DataSet) – the dataset to use when constructing the Gram matrix

• target_model (Model) – A model used to make sense of circuits and for the construction of a theoretical gram matrix and spectrum.

• max_basis_string_length (int, optional) – the maximum string length considered for Gram matrix basis elements. Defaults to 10.

• fixed_lists ((prep_fiducials, effect_fiducials), optional) – 2-tuple of Circuit lists, specifying the preparation and measurement fiducials to use when constructing the Gram matrix, and thereby bypassing the search for such lists.

Returns

• rank (integer)

• singularvalues (numpy array)

• targetsingularvalues (numpy array)