pygsti.modelmembers.instruments.tpinstrumentop
The TPInstrumentOp class and supporting functionality.
Module Contents
Classes
An element of a |
- class pygsti.modelmembers.instruments.tpinstrumentop.TPInstrumentOp(param_ops, index, basis=None)
Bases:
pygsti.modelmembers.operations.DenseOperator
An element of a
TPInstrument
.A partial implementation of
LinearOperator
which encapsulates an element of aTPInstrument
. Instances rely on their parent being a TPInstrument.Parameters
- param_opslist of LinearOperator objects
A list of the underlying operation objects which constitute a simple parameterization of a
TPInstrument
. Namely, this is the list of [MT,D1,D2,…Dn] operations which parameterize all of the TPInstrument’s elements.- indexint
The index indicating which element of the TPInstrument the constructed object is. Must be in the range [0,len(param_ops)-1].
- basisBasis or {‘pp’,’gm’,’std’} or None
The basis used to construct the Hilbert-Schmidt space representation of this state as a super-operator. If None, certain functionality, such as access to Kraus operators, will be unavailable.
Initialize a new LinearOperator
- property num_params
Get the number of independent parameters which specify this operation.
Returns
- int
the number of independent parameters.
- index
- num_instrument_elements
- relevant_param_ops
- to_memoized_dict(mmg_memo)
Create a serializable dict with references to other objects in the memo.
Parameters
- mmg_memo: dict
Memo dict from a ModelMemberGraph, i.e. keys are object ids and values are ModelMemberGraphNodes (which contain the serialize_id). This is NOT the same as other memos in ModelMember (e.g. copy, allocate_gpindices, etc.).
Returns
- mm_dict: dict
A dict representation of this ModelMember ready for serialization This must have at least the following fields: module, class, submembers, params, state_space, evotype Additional fields may be added by derived classes.
- deriv_wrt_params(wrt_filter=None)
The element-wise derivative this operation.
Construct a matrix whose columns are the vectorized derivatives of the flattened operation matrix with respect to a single operation parameter. Thus, each column is of length op_dim^2 and there is one column per operation parameter. An empty 2D array in the StaticArbitraryOp case (num_params == 0).
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 with shape (dimension^2, num_params)
- has_nonzero_hessian()
Whether this operation has a non-zero Hessian with respect to its parameters.
(i.e. whether it only depends linearly on its parameters or not)
Returns
bool
- to_vector()
Get the operation parameters as an array of values.
Returns
- numpy array
The operation parameters as a 1D array with length num_params().
- from_vector(v, close=False, dirty_value=True)
Initialize the operation using a vector of parameters.
Parameters
- vnumpy array
The 1D vector of operation parameters. Length must == num_params()
- closebool, optional
Whether v is close to this operation’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