pygsti.layouts.evaltree

Defines the EvalTree class.

Module Contents

Classes

EvalTree

Built-in mutable sequence.

Functions

_walk_subtree(treedict, indx, running_inds)

pygsti.layouts.evaltree._walk_subtree(treedict, indx, running_inds)
class pygsti.layouts.evaltree.EvalTree

Bases: list

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

classmethod create(cls, circuits_to_evaluate)

Note: circuits_to_evaluate can be either a list or an integer-keyed dict (for faster lookups), as we only take its length and index it.

Returns

eval_tree (list) – A list of instructions (tuples), where each element contains information about evaluating a particular circuit: (iDest, iLeft, iRight). In particular, eval_tree[iDest] = eval_tree[iLeft] + eval_tree[iRight] as sequences so that matrix(eval_tree[iDest]) = matrixOf(eval_tree[iRight]) * matrixOf(eval_tree[iLeft])

_create_single_item_trees(self, num_elements)
find_splitting(self, num_elements, max_sub_tree_size, num_sub_trees, verbosity)

Find a partition of the indices of circuit_tree to define a set of sub-trees 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
  • num_elements (int) – The number of elements self is meant to compute (this means that any tree indices >= num_elements are considered “scratch” space.

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

  • num_sub_trees (int, optional) – The maximum size (i.e. list length) of each sub-tree. If the original tree is smaller than this size, no splitting will occur.

  • verbosity (int, optional) – How much detail to send to stdout.

Returns

list – A list of sets of elements to place in sub-trees.