pygsti.modelmembers.states.check_deriv_wrt_params#
- check_deriv_wrt_params(state, deriv_to_check=None, wrt_filter=None, eps=1e-07)#
Checks the deriv_wrt_params method of a State object.
This routine is meant to be used as an aid in testing and debugging State classes by comparing the finite-difference Jacobian that should be returned by state.deriv_wrt_params with the one that actually is. A ValueError is raised if the two do not match.
- Parameters:
state (State) – The gate object to test.
deriv_to_check (numpy.ndarray or None, optional) – If not None, the Jacobian to compare against the finite difference result. If None, state.deriv_wrt_parms() is used. Setting this argument can be useful when the function is called within a LinearOperator class’s deriv_wrt_params() method itself as a part of testing.
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.)
eps (float, optional) – The finite difference step to use.
- Return type:
None