pygsti.models.stencillabel.StencilLabelAllCombos#
- class StencilLabelAllCombos(possible_sslbls, num_to_choose, connected=False)#
Bases:
StencilLabelA stencil label that expands into all the length-k combinations of a larger set of state space labels.
For example, if num_to_choose = 2 and possible_sslbls = [1,2,3] then this stencil label would expand into the pairs: [(1,2), (2,3), (1,3)]. Optionally, the tuples can be restricted to only those that form a connected sub-graph of the qubit graph (eliminating (1,3) in our example if the qubits were in a 1-2-3 chain).
- Parameters:
possible_sslbls (list or tuple) – The set of possible state space labels to take combinations of.
num_to_choose (int) – The number of possible state space labels to choose when forming each state space label tuple.
connected (bool, optional) – If True, restrict combinations to those that form a connected subgraph of the qubit graph.
Methods
__init__(possible_sslbls, num_to_choose[, ...])cast(obj)Convert an object into a stencil label if it isn't already.
compute_absolute_sslbls(qubit_graph, ...)Creates a list of all the state space label tuples this stencil label expands into.
create_local_state_space(entire_state_space)Creates a "local" state space for an operator indexed using this stencil label.
- classmethod cast(obj)#
Convert an object into a stencil label if it isn’t already.
- Parameters:
obj (object) – The object to convert.
- Return type:
- compute_absolute_sslbls(qubit_graph, state_space, target_lbls)#
Creates a list of all the state space label tuples this stencil label expands into.
- create_local_state_space(entire_state_space)#
Creates a “local” state space for an operator indexed using this stencil label.
When creating operator objects, a stencil label specifies where to place (embed) operators on some subset of the entire space. When these to-be-embedded operations are constructed, they need to be supplied with a state space that just corresponds to the sub-space where they act – a “local” state space. A stencil label expands into one or more state space label tuples, and this function constructs a single local state space that is appropriate for any and all of these tuples (i.e. what is returned by
compute_absolute_sslbls()), and that is therefore appropriate for constructing the to-be-embedded operation. Importantly, this function can be called without knowing where this stencil label will be placed, that is, it doesn’t require a “target labels” argument.- Parameters:
entire_state_space (StateSpace) – The entire state space of the relevant processor, specifying the state space labels and information about them.
- Return type: