pygsti.modelmembers.povms.povm
¶
Defines the POVM class
Module Contents¶
Classes¶
A generalized positive operator-valued measure (POVM). |
- class pygsti.modelmembers.povms.povm.POVM(state_space, evotype, items=[])¶
Bases:
pygsti.modelmembers.modelmember.ModelMember
,collections.OrderedDict
A generalized positive operator-valued measure (POVM).
Meant to correspond to a positive operator-valued measure, in theory, this class generalizes that notion slightly to include a collection of effect vectors that may or may not have all of the properties associated by a mathematical POVM.
- Parameters
state_space (StateSpace) – The state space of this POVM (and of the effect vectors).
evotype (Evotype) – The evolution type.
items (list or dict, optional) – Initial values. This should only be used internally in de-serialization.
- __setitem__(self, key, value)¶
Set self[key] to value.
- __pygsti_reduce__(self)¶
- property num_params(self)¶
Get the number of independent parameters which specify this POVM.
- Returns
int – the number of independent parameters.
- to_vector(self)¶
Extract a vector of the underlying gate parameters from this POVM.
- Returns
numpy array – a 1D numpy array with length == num_params().
- from_vector(self, v, close=False, dirty_value=True)¶
Initialize this POVM using a vector of its parameters.
- Parameters
v (numpy array) – The 1D vector of POVM parameters. Length must == num_params().
close (bool, optional) – Whether v is close to this POVM’s current set of parameters. Under some circumstances, when this is true this call can be completed more quickly.
dirty_value (bool, optional) – The value to set this object’s “dirty flag” to before exiting this call. This is passed as an argument so it can be updated recursively. Leave this set to True unless you know what you’re doing.
- Returns
None
- set_time(self, t)¶
Sets the current time for a time-dependent operator.
For time-independent operators (the default), this function does absolutely nothing.
- Parameters
t (float) – The current time.
- Returns
None
- transform_inplace(self, s)¶
Update each POVM effect E as s^T * E.
Note that this is equivalent to the transpose of the effect vectors being mapped as E^T -> E^T * s.
- Parameters
s (GaugeGroupElement) – A gauge group element which specifies the “s” matrix (and it’s inverse) used in the above similarity transform.
- Returns
None
- depolarize(self, amount)¶
Depolarize this POVM by the given amount.
- Parameters
amount (float or tuple) – The amount to depolarize by. If a tuple, it must have length equal to one less than the dimension of the gate. All but the first element of each spam vector (often corresponding to the identity element) are multiplied by amount (if a float) or the corresponding amount[i] (if a tuple).
- Returns
None
- property num_elements(self)¶
Return the number of total spam vector elements in this povm.
This is in general different from the number of parameters, which are the number of free variables used to generate all of the vector elements.
- Returns
int
- acton(self, state)¶
Compute the outcome probabilities the result from acting on state with this POVM.
- Parameters
state (State) – The state to act on
- Returns
OrderedDict – A dictionary whose keys are the outcome labels (strings) and whose values are the probabilities of seeing each outcome.
- __str__(self)¶
Return str(self).