pygsti.modelmembers.povms.povm

Defines the POVM class

Module Contents

Classes

POVM

A generalized positive operator-valued measure (POVM).

class pygsti.modelmembers.povms.povm.POVM(state_space, evotype, rep=None, items=None)

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_spaceStateSpace

The state space of this POVM (and of the effect vectors).

evotypeEvotype

The evolution type.

itemslist or dict, optional

Initial values. This should only be used internally in de-serialization.

Initialize a new ModelMember

property num_params

Get the number of independent parameters which specify this POVM.

Returns
int

the number of independent parameters.

property num_elements

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

to_vector()

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

Returns
numpy array

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

from_vector(v, close=False, dirty_value=True)

Initialize this POVM using a vector of its parameters.

Parameters
vnumpy array

The 1D vector of POVM parameters. Length must == num_params().

closebool, 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_valuebool, 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(t)

Sets the current time for a time-dependent operator.

For time-independent operators (the default), this function does absolutely nothing.

Parameters
tfloat

The current time.

Returns

None

transform_inplace(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
sGaugeGroupElement

A gauge group element which specifies the “s” matrix (and it’s inverse) used in the above similarity transform.

Returns

None

depolarize(amount)

Depolarize this POVM by the given amount.

Parameters
amountfloat 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

acton(state)

Compute the outcome probabilities the result from acting on state with this POVM.

Parameters
stateState

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.