pygsti.models.cloudnoisemodel

Defines the CloudNoiseModel class and supporting functions

Module Contents

Classes

CloudNoiseModel

A n-qudit model using a low-weight and geometrically local error model with a common "global idle" operation.

CloudNoiseLayerRules

Rules for composing a layer operation from the elements stored within a model.

class pygsti.models.cloudnoisemodel.CloudNoiseModel(processor_spec, gatedict, prep_layers=None, povm_layers=None, build_cloudnoise_fn=None, build_cloudkey_fn=None, simulator='map', evotype='default', errcomp_type='gates', implicit_idle_mode='none', verbosity=0)

Bases: pygsti.models.implicitmodel.ImplicitOpModel

A n-qudit model using a low-weight and geometrically local error model with a common “global idle” operation.

Parameters

processor_specProcessorSpec

The processor specification to create a model for. This object specifies the gate names and unitaries for the processor, and their availability on the processor.

gatedictdict

A dictionary (an OrderedDict if you care about insertion order) that associates with string-type gate names (e.g. “Gx”) LinearOperator, numpy.ndarray, or OpFactory objects. When the objects may act on fewer than the total number of qudits (determined by their dimension/shape) then they are repeatedly embedded into operation on the entire state space as specified by their availability within processor_spec. These operations represent the ideal target operations, and thus, any LinearOperator or OpFactory objects must be static, i.e., have zero parameters.

prep_layers, povm_layersNone or operator or dict or list, optional

The SPAM operations as n-qudit layer operations. If None, then no preps (or POVMs) are created. If a dict, then the keys are labels and the values are layer operators. If a list, then the elements are layer operators and the labels will be assigned as “rhoX” and “MX” where X is an integer starting at 0. If a single layer operation is given, then this is used as the sole prep or POVM and is assigned the label “rho0” or “Mdefault” respectively.

build_cloudnoise_fnfunction, optional

A function which takes a single Label as an argument and returns the cloud-noise operation for that primitive layer operation. Note that if errcomp_type=”gates” the returned operator should be a superoperator whereas if errcomp_type=”errorgens” then the returned operator should be an error generator (not yet exponentiated).

build_cloudkey_fnfunction, optional

An function which takes a single Label as an argument and returns a “cloud key” for that primitive layer. The “cloud” is the set of qudits that the error (the operator returned from build_cloudnoise_fn) touches – and the “key” returned from this function is meant to identify that cloud. This is used to keep track of which primitive layer-labels correspond to the same cloud - e.g. the cloud-key for (“Gx”,2) and (“Gy”,2) might be the same and could be processed together when selecing sequences that amplify the parameters in the cloud-noise operations for these two labels. The return value should be something hashable with the property that two noise which act on the same qudits should have the same cloud key.

simulatorForwardSimulator or {“auto”, “matrix”, “map”}

The circuit simulator used to compute any requested probabilities, e.g. from probs() or bulk_probs(). The default value of “auto” automatically selects the simulation type, and is usually what you want. Other special allowed values are:

  • “matrix” : op_matrix-op_matrix products are computed and cached to get composite gates which can then quickly simulate a circuit for any preparation and outcome. High memory demand; best for a small number of (1 or 2) qubits.

  • “map” : op_matrix-state_vector products are repeatedly computed to simulate circuits. Slower for a small number of qubits, but faster and more memory efficient for higher numbers of qubits (3+).

evotypeEvotype or str, optional

The evolution type of this model, describing how states are represented. The special value “default” is equivalent to specifying the value of pygsti.evotypes.Evotype.default_evotype.

errcomp_type{“gates”,”errorgens”}

How errors are composed when creating layer operations in the created model. “gates” means that the errors on multiple gates in a single layer are composed as separate and subsequent processes. Specifically, the layer operation has the form Composed(target,idleErr,cloudErr) where target is a composition of all the ideal gate operations in the layer, idleErr is idle error (.operation_blks[‘layers’][‘globalIdle’]), and cloudErr is the composition (ordered as layer-label) of cloud- noise contributions, i.e. a map that acts as the product of exponentiated error-generator matrices. “errorgens” means that layer operations have the form Composed(target, error) where target is as above and error results from composing the idle and cloud-noise error generators, i.e. a map that acts as the exponentiated sum of error generators (ordering is irrelevant in this case).

implicit_idle_mode{‘none’, ‘add_global’, ‘pad_1Q’, ‘only_global’}

The way idle operations are added implicitly within the created model. “none” doesn’t add any “extra” idle operations when there is a layer that contains some gates but not gates on all the qubits. “add_global” adds the global idle operation, i.e., the operation for a global idle layer (zero gates - a completely empty layer), to every layer that is simulated, using the global idle as a background idle that always occurs regardless of the operation. “pad_1Q” applies the 1-qubit idle gate (if one exists) to all idling qubits within a circuit layer. “only_global” uses a global idle operation, if one exists, to simulate the completely empty layer but nothing else, i.e., this idle operation is not added to other layers as in “add_global”.

verbosityint, optional

An integer >= 0 dictating how must output to send to stdout.

Creates a new OpModel. Rarely used except from derived classes __init__ functions.

property clouds

Returns the set of cloud-sets used when creating sequences which amplify the parameters of this model.

Returns

dict

create_processor_spec()
errorgen_coefficients(normalized_elem_gens=True)

TODO: docstring - returns a nested dict containing all the error generator coefficients for all the operations in this model.

class pygsti.models.cloudnoisemodel.CloudNoiseLayerRules(errcomp_type, qubit_labels, implicit_idle_mode, singleq_idle_layer_labels, implied_global_idle_label)

Bases: pygsti.models.layerrules.LayerRules

Rules for composing a layer operation from the elements stored within a model.

A LayerRules object serves as an intermediary between a ImplicitModel object and a ForwardSimulator. It contains the logic for creating layer operations based on the partial/fundamental operation “blocks” stored within the model. Since different models hold different operation blocks, layer rules are usually tailored to a specific models.

prep_layer_operator(model, layerlbl, caches)

Create the operator corresponding to layerlbl.

Parameters

layerlblLabel

A circuit layer label.

Returns

State

povm_layer_operator(model, layerlbl, caches)

Create the operator corresponding to layerlbl.

Parameters

layerlblLabel

A circuit layer label.

Returns

POVM or POVMEffect

operation_layer_operator(model, layerlbl, caches)

Create the operator corresponding to layerlbl.

Parameters

layerlblLabel

A circuit layer label.

Returns

LinearOperator