pygsti.modelmembers.povms.conjugatedeffect
¶
The ConjugatedStatePOVMEffect class and supporting functionality.
Module Contents¶
Classes¶
Adds a numpyarraymimicing interface onto a POVM effect object. 

TODO: update docstring 
 class pygsti.modelmembers.povms.conjugatedeffect.DenseEffectInterface¶
Bases:
object
Adds a numpyarraymimicing interface onto a POVM effect object.
 property _ptr(self)¶
 _ptr_has_changed(self)¶
Derived classes should override this function to handle rep updates when the _ptr property is changed.
 property columnvec(self)¶
Direct access the the underlying data as column vector, i.e, a (dim,1)shaped array.
 __copy__(self)¶
 __deepcopy__(self, memo)¶
 __getitem__(self, key)¶
 __getslice__(self, i, j)¶
 __setitem__(self, key, val)¶
 __getattr__(self, attr)¶
 __pos__(self)¶
 __neg__(self)¶
 __abs__(self)¶
 __add__(self, x)¶
 __radd__(self, x)¶
 __sub__(self, x)¶
 __rsub__(self, x)¶
 __mul__(self, x)¶
 __rmul__(self, x)¶
 __truediv__(self, x)¶
 __rtruediv__(self, x)¶
 __floordiv__(self, x)¶
 __rfloordiv__(self, x)¶
 __pow__(self, x)¶
 __eq__(self, x)¶
Return self==value.
 __len__(self)¶
 __int__(self)¶
 __long__(self)¶
 __float__(self)¶
 __complex__(self)¶
 class pygsti.modelmembers.povms.conjugatedeffect.ConjugatedStatePOVMEffect(state)¶
Bases:
DenseEffectInterface
,pygsti.modelmembers.povms.effect.POVMEffect
TODO: update docstring A POVM effect vector that behaves like a numpy array.
This class is the common base class for parameterizations of an effect vector that have a dense representation and can be accessed like a numpy array.
 Parameters
vec (numpy.ndarray) – The POVM effect vector as a dense numpy array.
evotype ({"statevec", "densitymx"}) – The evolution type.
 _base_1d¶
Direct access to the underlying 1D array.
 Type
numpy.ndarray
 base¶
Direct access the the underlying data as column vector, i.e, a (dim,1)shaped array.
 Type
numpy.ndarray
 property parameter_labels(self)¶
An array of labels (usually strings) describing this model member’s parameters.
 to_dense(self, on_space='minimal', scratch=None)¶
Return this POVM effect vector as a (dense) numpy array.
The memory in scratch maybe used when it is notNone.
 Parameters
on_space ({'minimal', 'Hilbert', 'HilbertSchmidt'}) – The space that the returned dense operation acts upon. For unitary matrices and bra/ket vectors, use ‘Hilbert’. For superoperator matrices and superbra/superket vectors use ‘HilbertSchmidt’. ‘minimal’ means that ‘Hilbert’ is used if possible given this operator’s evolution type, and otherwise ‘HilbertSchmidt’ is used.
scratch (numpy.ndarray, optional) – scratch space available for use.
 Returns
numpy.ndarray
 property _ptr(self)¶
 _ptr_has_changed(self)¶
Derived classes should override this function to handle rep updates when the _ptr property is changed.
 property size(self)¶
Return the number of independent elements in this gate (when viewed as a dense array)
 Returns
int
 __str__(self)¶
Return str(self).
 submembers(self)¶
Get the ModelMemberderived objects contained in this one.
 Returns
list
 property num_params(self)¶
Get the number of independent parameters which specify this POVM effect vector.
 Returns
int – the number of independent parameters.
 to_vector(self)¶
Get the POVM effect vector parameters as an array of values.
 Returns
numpy array – The parameters as a 1D array with length num_params().
 from_vector(self, v, close=False, dirty_value=True)¶
Initialize the POVM effect vector using a 1D array of parameters.
 Parameters
v (numpy array) – The 1D vector of POVM effect vector parameters. Length must == num_params()
close (bool, optional) – Whether v is close to this POVM effect vector’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
 deriv_wrt_params(self, wrt_filter=None)¶
The elementwise derivative this POVM effect vector.
Construct a matrix whose columns are the derivatives of the POVM effect vector with respect to a single param. Thus, each column is of length dimension and there is one column per POVM effect parameter.
 Parameters
wrt_filter (list or numpy.ndarray) – List of parameter indices to take derivative with respect to. (None means to use all the this operation’s parameters.)
 Returns
numpy array – Array of derivatives, shape == (dimension, num_params)
 has_nonzero_hessian(self)¶
Whether this POVM effect vector has a nonzero Hessian with respect to its parameters.
 Returns
bool
 hessian_wrt_params(self, wrt_filter1=None, wrt_filter2=None)¶
Construct the Hessian of this POVM effect vector with respect to its parameters.
This function returns a tensor whose first axis corresponds to the flattened operation matrix and whose 2nd and 3rd axes correspond to the parameters that are differentiated with respect to.
 Parameters
wrt_filter1 (list or numpy.ndarray) – List of parameter indices to take 1st derivatives with respect to. (None means to use all the this operation’s parameters.)
wrt_filter2 (list or numpy.ndarray) – List of parameter indices to take 2nd derivatives with respect to. (None means to use all the this operation’s parameters.)
 Returns
numpy array – Hessian with shape (dimension, num_params1, num_params2)
 taylor_order_terms(self, order, max_polynomial_vars=100, return_coeff_polys=False)¶
Get the orderth order Taylorexpansion terms of this state vector.
This function either constructs or returns a cached list of the terms at the given order. Each term is “rank1”, meaning that it is a state preparation followed by or POVM effect preceded by actions on a density matrix rho of the form:
rho > A rho B
The coefficients of these terms are typically polynomials of the State’s parameters, where the polynomial’s variable indices index the global parameters of the State’s parent (usually a
Model
) , not the State’s local parameter array (i.e. that returned from to_vector). Parameters
order (int) – The order of terms to get.
max_polynomial_vars (int, optional) – maximum number of variables the created polynomials can have.
return_coeff_polys (bool) – Whether a parallel list of locallyindexed (using variable indices corresponding to this object’s parameters rather than its parent’s) polynomial coefficients should be returned as well.
 Returns
terms (list) – A list of
RankOneTerm
objects.coefficients (list) – Only present when return_coeff_polys == True. A list of compact polynomial objects, meaning that each element is a (vtape,ctape) 2tuple formed by concatenating together the output of :method:`Polynomial.compact`.
 classmethod _from_memoized_dict(cls, mm_dict, serial_memo)¶
For subclasses to implement. Submemberexistence checks are performed, and the gpindices of the return value is set, by the nonunderscored :method:`from_memoized_dict` implemented in this class.