pygsti.layouts.evaltree

Defines the EvalTree class.

Module Contents

Classes

EvalTree

Built-in mutable sequence.

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.

Initialize self. See help(type(self)) for accurate signature.

classmethod create(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_treelist

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])

find_splitting(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_elementsint

The number of elements self is meant to compute (this means that any tree indices >= num_elements are considered “scratch” space.

max_sub_tree_sizeint, 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_treesint, 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.

verbosityint, optional

How much detail to send to stdout.

Returns

list

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