pygsti.modelmembers.povms.tppovm

Defines the TPPOVM class

Module Contents

Classes

TPPOVM

A POVM whose sum-of-effects is constrained to what, by definition, we call the "identity".

class pygsti.modelmembers.povms.tppovm.TPPOVM(effects, evotype=None, state_space=None, called_from_reduce=False)

Bases: pygsti.modelmembers.povms.basepovm._BasePOVM, pygsti.modelmembers.torchable.Torchable

A POVM whose sum-of-effects is constrained to what, by definition, we call the “identity”.

Parameters

effectsdict of POVMEffects or array-like

A dict (or list of key,value pairs) of the effect vectors. The final effect vector will be stripped of any existing parameterization and turned into a ComplementPOVMEffect which has no additional parameters and is always equal to identity - sum(other_effects, where identity is the sum of effects when this __init__ call is made.

evotypeEvotype or str, optional

The evolution type. If None, the evotype is inferred from the first effect vector. If len(effects) == 0 in this case, an error is raised.

state_spaceStateSpace, optional

The state space for this POVM. If None, the space is inferred from the first effect vector. If len(effects) == 0 in this case, an error is raised.

Notes

Just like TPState, we’re restricted to the Pauli-product or Gell-Mann basis.

We inherit from BasePOVM, which inherits from POVM, which inherits from OrderedDict.

A TPPOVM “p” has an attribute p.complement_label that’s set during construction. This label is such that e = p[p.complement_label] is a ComplementPOVMEffect, with an associated FullState object given in e.identity. If v = e.identity.to_vector(), then e’s vector representation is

v - sum(all non-complement effects in p).

Under typical conditions v will be proportional to the first standard basis vector, and, in fact, if v is length “d,” then we’ll have v[0] == d ** 0.25. However, neither of these conditions is strictly required by the API.

Creates a new BasePOVM object.

Parameters

effectsdict of POVMEffects or array-like

A dict (or list of key,value pairs) of the effect vectors.

evotypeEvotype or str, optional

The evolution type. If None, the evotype is inferred from the first effect vector. If len(effects) == 0 in this case, an error is raised.

state_spaceStateSpace, optional

The state space for this POVM. If None, the space is inferred from the first effect vector. If len(effects) == 0 in this case, an error is raised.

preserve_sumbool, optional

If true, the sum of effects is taken to be a constraint and so the final effect vector is made into a ComplementPOVMEffect.

property dim
to_vector()

Extract a vector of the underlying gate parameters from this POVM.

Returns
numpy array

a 1D numpy array with length == num_params().

stateless_data() Tuple[int, numpy.ndarray]

Return this ModelMember’s data that is considered constant for purposes of model fitting.

Note: the word “stateless” here is used in the sense of object-oriented programming.

static torch_base(sd: Tuple[int, numpy.ndarray], t_param: torch.Tensor) torch.Tensor

Suppose “obj” is an instance of some Torchable subclass. If we compute

vec = obj.to_vector() t_param = torch.from_numpy(vec) sd = obj.stateless_data() t = type(obj).torch_base(sd, t_param)

then t will be a PyTorch Tensor that represents “obj” in a canonical numerical way.

The meaning of “canonical” is implementation dependent. If type(obj) implements the .base attribute, then a reasonable implementation will probably satisfy

np.allclose(obj.base, t.numpy()).