pygsti.modelmembers.operations.fullcptpop

The FullCPTPOp class and supporting functionality.

Module Contents

Classes

FullCPTPOp

TODO: update docstring

Attributes

IMAG_TOL

pygsti.modelmembers.operations.fullcptpop.IMAG_TOL = 1e-07
class pygsti.modelmembers.operations.fullcptpop.FullCPTPOp(choi_mx, basis, evotype, state_space=None, truncate=False)

Bases: pygsti.modelmembers.operations.krausop.KrausOperatorInterface, pygsti.modelmembers.operations.linearop.LinearOperator

TODO: update docstring An operator that is constrained to be CPTP.

This operation is parameterized by (normalized) elements of the Cholesky decomposition of the quantum channel’s Choi matrix.

Initialize a new LinearOperator

property num_params

Get the number of independent parameters which specify this state vector.

Returns

int

the number of independent parameters.

classmethod from_superop_matrix(superop_mx, basis, evotype, state_space=None, truncate=False)
to_dense(on_space='minimal')

Return the dense array used to represent this operation within its evolution type.

Note: for efficiency, this doesn’t copy the underlying data, so the caller should copy this data before modifying it.

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 super-bra/super-ket vectors use ‘HilbertSchmidt’. ‘minimal’ means that ‘Hilbert’ is used if possible given this operator’s evolution type, and otherwise ‘HilbertSchmidt’ is used.

Returns

numpy.ndarray

to_vector()

Get the state vector parameters as an array of values.

Returns

numpy array

The parameters as a 1D array with length num_params().

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

Initialize the state vector using a 1D array of parameters.

Parameters

vnumpy array

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

closebool, optional

Whether v is close to this state vector’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

abstract deriv_wrt_params(wrt_filter=None)

The element-wise derivative this state vector.

Construct a matrix whose columns are the derivatives of the state vector with respect to a single param. Thus, each column is of length dimension and there is one column per state vector parameter.

Parameters

wrt_filterlist 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()

Whether this state vector has a non-zero Hessian with respect to its parameters.

Returns

bool

abstract hessian_wrt_params(wrt_filter1=None, wrt_filter2=None)

Construct the Hessian of this state 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_filter1list 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_filter2list 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)