pygsti.tools.listtools

pygsti.tools.listtools#

Utility functions for working with lists

Functions

apply_aliases_to_circuits(list_of_circuits, ...)

Applies alias_dict to the circuits in list_of_circuits.

compute_occurrence_indices(lst)

A 0-based list of integers specifying which occurrence, i.e. enumerated duplicate, each list item is.

find_replace_tuple(t, alias_dict)

Replace elements of t according to rules in alias_dict.

find_replace_tuple_list(list_of_tuples, ...)

Applies find_replace_tuple() on each element of list_of_tuples.

incd_product(*args)

Like itertools.product but returns the first modified (incremented) index along with the product tuple itself.

lists_to_tuples(obj)

Recursively replaces lists with tuples.

partition_into(n, nbins)

Iterate over all partitions of integer n into nbins bins.

partitions(n)

Iterate over all partitions of integer n.

remove_duplicates(l[, index_to_test])

Remove duplicates from the a list and return the result.

remove_duplicates_in_place(l[, index_to_test])

Remove duplicates from the list passed as an argument.

sorted_partitions(n)

Iterate over all sorted (decreasing) partitions of integer n.