pygsti.modelmembers.states.densestate
The DenseState and DensePureState classes and supporting functionality.
Module Contents
Classes
Adds a numpyarraymimicing interface onto a state object. 

TODO: update docstring 

TODO: docstring  a state that is interfaced as a dense ket 
 class pygsti.modelmembers.states.densestate.DenseStateInterface
Bases:
object
Adds a numpyarraymimicing interface onto a state object.
 property columnvec
Direct access the the underlying data as column vector, i.e, a (dim,1)shaped array.
 to_array()
Return the array used to identify this state within its range of possible values.
For instance, if the state is a pure state, this returns a complex purestate vector regardless of the evolution type. The related
to_dense()
method, in contrast, returns the dense representation of the state, which varies by evolution type.Returns
numpy.ndarray
 class pygsti.modelmembers.states.densestate.DenseState(vec, basis, evotype, state_space)
Bases:
DenseStateInterface
,pygsti.modelmembers.states.state.State
TODO: update docstring A state preparation vector that is interfaced/behaves as a dense superket (a numpy array).
This class is the common base class for parameterizations of a state vector that have a dense representation and can be accessed like a numpy array.
Parameters
 vecnumpy.ndarray
The SPAM vector as a dense numpy array.
 evotype{“statevec”, “densitymx”}
The evolution type.
Attributes
 _base_1dnumpy.ndarray
Direct access to the underlying 1D array.
 basenumpy.ndarray
Direct access the the underlying data as column vector, i.e, a (dim,1)shaped array.
Initialize a new state Vector
 to_dense(on_space='minimal', scratch=None)
Return the dense array used to represent this state within its evolution type.
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.
 scratchnumpy.ndarray, optional
scratch space available for use.
Returns
numpy.ndarray
 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.
 class pygsti.modelmembers.states.densestate.DensePureState(purevec, basis, evotype, state_space)
Bases:
DenseStateInterface
,pygsti.modelmembers.states.state.State
TODO: docstring  a state that is interfaced as a dense ket
Initialize a new state Vector
 to_dense(on_space='minimal', scratch=None)
Return the dense array used to represent this state within its evolution type.
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.
 scratchnumpy.ndarray, optional
scratch space available for use.
Returns
numpy.ndarray
 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.