pygsti.models.localnoisemodel
Defines the LocalNoiseModel class and supporting functions
Module Contents
Classes
A n-qudit implicit model that allows for only local noise. |
- class pygsti.models.localnoisemodel.LocalNoiseModel(processor_spec, gatedict, prep_layers=None, povm_layers=None, evotype='default', simulator='auto', on_construction_error='raise', independent_gates=False, ensure_composed_gates=False, implicit_idle_mode='none')
Bases:
pygsti.models.implicitmodel.ImplicitOpModelA n-qudit implicit model that allows for only local noise.
This model holds as building blocks individual noisy gates which are trivially embedded into circuit layers as requested.
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 gate names (e.g. “Gx”)
LinearOperator, numpy.ndarray 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. While the keys of this dictionary are usually string-type gate names, labels that include target qudits, e.g. (“Gx”,0), may be used to override the default behavior of embedding a reference or a copy of the gate associated with the same label minus the target qudits (e.g. “Gx”). Furthermore,OpFactoryobjects may be used in place of LinearOperator objects to allow the evaluation of labels with arguments.- prep_layersNone or operator or dict or list
The state preparateion operations as n-qudit layer operations. If None, then no state preparations will be present in the created model. 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” where X is an integer starting at 0. If a single layer operation of type
Stateis given, then this is used as the sole prep and is assigned the label “rho0”.- povm_layersNone or operator or dict or list
The state preparateion operations as n-qudit layer operations. If None, then no POVMS will be present in the created model. 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 “MX” where X is an integer starting at 0. If a single layer operation of type
POVMis given, then this is used as the sole POVM and is assigned the label “Mdefault”.- 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.
- simulatorForwardSimulator or {“auto”, “matrix”, “map”}
The circuit simulator used to compute any requested probabilities, e.g. from
probs()orbulk_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+).
- on_construction_error{‘raise’,’warn’,ignore’}
What to do when the conversion from a value in gatedict to a
LinearOperatorof the type given by parameterization fails. Usually you’ll want to “raise” the error. In some cases, for example when converting as many gates as you can into parameterization=”clifford” gates, “warn” or even “ignore” may be useful.- independent_gatesbool, optional
Whether gates are allowed independent local noise or not. If False, then all gates with the same name (e.g. “Gx”) will have the same (local) noise (e.g. an overrotation by 1 degree), and the operation_bks[‘gates’] dictionary contains a single key per gate name. If True, then gates with the same name acting on different qudits may have different local noise, and so the operation_bks[‘gates’] dictionary contains a key for each gate available gate placement.
- ensure_composed_gatesbool, optional
If True then the elements of the operation_bks[‘gates’] will always be
ComposedOpobjects. The purpose of this is to facilitate modifying the gate operations after the model is created. If False, then the appropriately parameterized gate objects (often dense gates) are used directly.- 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”.
Creates a new OpModel. Rarely used except from derived classes __init__ functions. Parameters ———- state_space : StateSpace
The state space for this model.
- basisBasis
The basis used for the state space by dense operator representations.
- 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.
- layer_rulesLayerRules
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.
- simulatorForwardSimulator or {“auto”, “matrix”, “map”}
The forward simulator (or typ) that this model should use. “auto” tries to determine the best type automatically.
- processor_spec
- 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.