pygsti.baseobjs.errorgenlabel.GlobalElementaryErrorgenLabel#

class GlobalElementaryErrorgenLabel(errorgen_type, basis_element_labels, sslbls, sort=True)#

Bases: ElementaryErrorgenLabel

Labels an elementary error generator on n qubits that includes the state space labels on which the generator acts (unlike a “local” label, i.e. a LocalElementaryErrorgenLabel which doesn’t)

Parameters:
  • errorgen_type (str) – A string corresponding to the error generator sector this error generator label is an element of. Allowed values are ‘H’, ‘S’, ‘C’ and ‘A’.

  • basis_element_labels (tuple or list) – A list or tuple of strings labeling basis elements used to label this error generator. This is either length-1 for ‘H’ and ‘S’ type error generators, or length-2 for ‘C’ and ‘A’ type.

  • sslbls (tuple or list) – A tuple or list of state space labels corresponding to the qudits upon which this error generator is supported.

  • sort (bool, optional (default True)) – If True then the input state space labels are first sorted, and then the used basis element labels are sorted to match the order to the newly sorted state space labels.

Methods

__init__(errorgen_type, ...[, sort])

cast(obj[, sslbls, identity_label])

Method for casting an object to an instance of GlobalElementaryErrorgenLabel

map_state_space_labels(mapper)

Creates a new GlobalElementaryErrorgenLabel whose sslbls attribute is updated according to a mapping function.

padded_basis_element_labels(all_sslbls[, ...])

Idle-padded versions of this label's basis element labels based on its state space labels.

sort_sslbls()

Creates a new GlobalElementaryErrorgenLabel with sorted (potentially reordered) state space labels.

Attributes

support

Returns a sorted tuple of the elements of self.sslbls

classmethod cast(obj, sslbls=None, identity_label='I')#

Method for casting an object to an instance of GlobalElementaryErrorgenLabel

Parameters:
  • obj (GlobalElementaryErrorgenLabel, LocalElementaryErrorgenLabel, tuple or list) –

    Object to cast. If a LocalElementaryErrorgenLabel then a value for the sslbls argument should be passed with the full list of state space labels for the system. Other castable options include:

    -str: Following formatting options are supported.
    • A string formatted as ‘<type>(<bel1>[,<bel2>]:(<sslbls>))’ where <sslbls> is the subset of state-space labels this error generator acts on nontrivially specified as a comma-separated list. E.g. ‘H(XX:0,1)’ or ‘S(XIY):0,2’.

    • A string formatted as <type><bel>:<sslbls>, where <sslbls> is the subset of state-space labels this error generator acts on nontrivially specified as a comma-separated list. E.g. ‘HXX:0,1’ or ‘SIX:1’. Note this style is only compatible with basis element label error generators, and this only H and S.

    • A string formatted as <type><bel>. For this style the basis element label is assumed to correspond to the entire state space, and as such the sslbls kwarg for this method must also be specified. Like the previous example this is also only compatible with H and S terms.

    -tuple/list: These can be specified either in ‘global-style’ or ‘local-style’.
    • local-style: format is (<type>, <bel1>[,<bel2>])

    • global-style:format is (<type>, (<bel1>,[<bel2>]), (<sslbls>)) Where sslbls above is specifically the subset of state space labels this error generator acts on nontrivially. When specifying global-style tuple labels the sslbls kwarg of this method which contains the complete set of state-space labels must also be specified.

  • sslbls (tuple or list, optional (default None)) – A complete set of state space labels. Used when casting from a LocalElementaryErrorgenLabel or from a tuple of length 2 (wherein the final element is interpreted as the set of ssblbs the error generator acts upon).

  • identity_label (str, optional (default 'I')) – An optional string specifying the label used to denote the identity in basis element labels.

Return type:

GlobalElementaryErrorgenLabel

map_state_space_labels(mapper)#

Creates a new GlobalElementaryErrorgenLabel whose sslbls attribute is updated according to a mapping function.

Parameters:

mapper (dict or function) – A dictionary whose keys are the existing self.sslbls values and whose value are the new labels, or a function which takes a single existing state space label argument and returns a new state space label to replace it with.

Return type:

GlobalElementaryErrorgenLabel

padded_basis_element_labels(all_sslbls, identity_label='I')#

Idle-padded versions of this label’s basis element labels based on its state space labels.

A tuple of strings which positions the non-trivial single-qubit labels within the elements of self.basis_element_labels into a background of identity_label characters. For example, if the ordering of all_sslbls is (0, 1, 2), self.sslbls is (1,), and self.basis_element_labels is (‘X’,) then this method returns (‘IXI’,).

For this method to work correctly, basis element labels should be composed of single characters corresponding to non-trivial single-qubit basis elements, and the total basis element should be a product of these along with the identity on the state space labels absent from self.sslbls.

Parameters:
  • all_sslbls (tuple) – An ordered list of the entirety of the state space labels to create padded basis element labels for. For example, (0, 1, 2) or (‘Q0’, ‘Q1’, ‘Q2’).

  • identity_label (str, optional) – The single-character label used to indicate the single-qubit identity operation.

Returns:

A tuple of strings.

Return type:

tuple

sort_sslbls()#

Creates a new GlobalElementaryErrorgenLabel with sorted (potentially reordered) state space labels.

This puts the label into a canonical form that can be useful for comparison with other labels.

Return type:

GlobalElementaryErrorgenLabel

property support#

Returns a sorted tuple of the elements of self.sslbls