pygsti.modelmembers.states.fullpurestate
¶
The FullPureState class and supporting functionality.
Module Contents¶
Classes¶
A "fully parameterized" state vector where each element is an independent parameter. |
- class pygsti.modelmembers.states.fullpurestate.FullPureState(purevec, basis='pp', evotype='default', state_space=None)¶
Bases:
pygsti.modelmembers.states.densestate.DensePureState
A “fully parameterized” state vector where each element is an independent parameter.
- Parameters
vec (array_like or State) – a 1D numpy array representing the state operation. The shape of this array sets the dimension of the state op.
basis (Basis or {'pp','gm','std'}, optional) – The basis used to construct the Hilbert-Schmidt space representation of this state as a super-ket.
evotype (Evotype or str, optional) – The evolution type. The special value “default” is equivalent to specifying the value of pygsti.evotypes.Evotype.default_evotype.
state_space (StateSpace, optional) – The state space for this operation. If None a default state space with the appropriate number of qubits is used.
- property num_params(self)¶
Get the number of independent parameters which specify this state vector.
- Returns
int – the number of independent parameters.
- to_vector(self)¶
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(self, v, close=False, dirty_value=True)¶
Initialize the state vector using a 1D array of parameters.
- Parameters
v (numpy array) – The 1D vector of state vector parameters. Length must == num_params()
close (bool, 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_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 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_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 state vector has a non-zero Hessian with respect to its parameters.
- Returns
bool