pygsti.modelmembers.states.finite_difference_deriv_wrt_params

pygsti.modelmembers.states.finite_difference_deriv_wrt_params#

finite_difference_deriv_wrt_params(state, wrt_filter=None, eps=1e-07)#

Computes a finite-difference Jacobian for a State object.

The returned value is a matrix whose columns are the vectorized derivatives of the spam vector with respect to a single parameter, matching the format expected from the spam vectors’s deriv_wrt_params method.

Parameters:
  • state (State) – The spam vector object to compute a Jacobian for.

  • 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.

Returns:

An M by N matrix where M is the number of gate elements and N is the number of gate parameters.

Return type:

numpy.ndarray