pygsti.layouts.prefixtable

Defines the PrefixTable class.

Module Contents

Classes

PrefixTable

An ordered list ("table") of circuits to evaluate, where common prefixes can be cached.

class pygsti.layouts.prefixtable.PrefixTable(circuits_to_evaluate, max_cache_size)

Bases: object

An ordered list (“table”) of circuits to evaluate, where common prefixes can be cached.

Creates a “prefix table” for evaluating a set of circuits.

The table is list of tuples, where each element contains instructions for evaluating a particular operation sequence:

(iDest, iStart, tuple_of_following_items, iCache)

Means that circuit[iDest] = cached_circuit[iStart] + tuple_of_following_items, and that the resulting state should be stored at cache index iCache (for later reference as an iStart value). The ordering of the returned list specifies the evaluation order.

iDest is always in the range [0,len(circuits_to_evaluate)-1], and indexes the result computed for each of the circuits.

Returns

tuple

A tuple of (table_contents, cache_size) where table_contents is a list of tuples as given above and cache_size is the total size of the state cache used to hold intermediate results.

find_splitting(max_sub_table_size=None, num_sub_tables=None, cost_metric='size', verbosity=0)

Find a partition of the indices of this table to define a set of sub-tables with the desire properties.

This is done in order to reduce the maximum size of any tree (useful for limiting memory consumption or for using multiple cores). Must specify either max_sub_tree_size or num_sub_trees.

Parameters
max_sub_table_sizeint, optional

The maximum size (i.e. list length) of each sub-table. If the original table is smaller than this size, no splitting will occur. If None, then there is no limit.

num_sub_tablesint, optional

The maximum size (i.e. list length) of each sub-table. If the original table is smaller than this size, no splitting will occur.

verbosityint, optional

How much detail to send to stdout.

Returns
list

A list of sets of elements to place in sub-tables.