pygsti.models.implicitmodel

Defines the ImplicitOpModel class and supporting functionality.

Module Contents

Classes

ImplicitOpModel

A model that stores the building blocks for layer operations and build circuit-layer operations on-demand.

Functions

_init_spam_layers(model, prep_layers, povm_layers)

Helper function for initializing the .prep_blks and .povm_blks elements of an implicit model

class pygsti.models.implicitmodel.ImplicitOpModel(state_space, layer_rules, basis='pp', simulator='auto', evotype='densitymx')

Bases: pygsti.models.model.OpModel

A model that stores the building blocks for layer operations and build circuit-layer operations on-demand.

An ImplicitOpModel represents a flexible QIP model whereby only the building blocks for layer operations are stored, and custom layer-lizard logic is used to construct layer operations from these blocks on an on-demand basis.

Parameters
  • state_space (StateSpace) – The state space for this model.

  • layer_rules (LayerRules) – The “layer rules” used for constructing operators for circuit layers. This functionality is essential to using this model to simulate ciruits, and is typically supplied by derived classes.

  • basis (Basis) – The basis used for the state space by dense operator representations.

  • simulator (ForwardSimulator or {"auto", "matrix", "map"}) – The circuit simulator used to compute any requested probabilities, e.g. from :method:`probs` or

  • evotype ({"densitymx", "statevec", "stabilizer", "svterm", "cterm"}) – The evolution type of this model, describing how states are represented, allowing compatibility checks with (super)operator objects.

property _primitive_prep_label_dict(self)
property _primitive_povm_label_dict(self)
property _primitive_op_label_dict(self)
property _primitive_instrument_label_dict(self)
_iter_parameterized_objs(self)
_init_copy(self, copy_into, memo)

Copies any “tricky” member of this model into copy_into, before deep copying everything else within a .copy() operation.

__setstate__(self, state_dict)
compute_clifford_symplectic_reps(self, oplabel_filter=None)

Constructs a dictionary of the symplectic representations for all the Clifford gates in this model.

Non-StaticCliffordOp gates will be ignored and their entries omitted from the returned dictionary.

Parameters

oplabel_filter (iterable, optional) – A list, tuple, or set of operation labels whose symplectic representations should be returned (if they exist).

Returns

dict – keys are operation labels and/or just the root names of gates (without any state space indices/labels). Values are (symplectic_matrix, phase_vector) tuples.

__str__(self)

Return str(self).

_default_primitive_povm_layer_lbl(self, sslbls)

Gets the default POVM label.

This is often used when a circuit is specified without an ending POVM layer. Returns None if there is no default and one must be specified.

Parameters

sslbls (tuple or None) – The state space labels being measured, and for which a default POVM is desired.

Returns

Label or None

_effect_labels_for_povm(self, povm_lbl)

Gets the effect labels corresponding to the possible outcomes of POVM label povm_lbl.

Parameters

povm_lbl (Label) – POVM label.

Returns

list – A list of strings which label the POVM outcomes.

_member_labels_for_instrument(self, inst_lbl)

Gets the member labels corresponding to the possible outcomes of the instrument labeled by inst_lbl.

Parameters

inst_lbl (Label) – Instrument label.

Returns

list – A list of strings which label the instrument members.

_reinit_opcaches(self)

Called when parameter vector structure changes and self._opcaches should be cleared & re-initialized

create_modelmember_graph(self)

Generate a ModelMemberGraph for the model.

Returns

ModelMemberGraph – A directed graph capturing dependencies among model members

_to_nice_serialization(self)
classmethod _from_nice_serialization(cls, state)
pygsti.models.implicitmodel._init_spam_layers(model, prep_layers, povm_layers)

Helper function for initializing the .prep_blks and .povm_blks elements of an implicit model