pygsti.modelmembers.operations.denseop.check_deriv_wrt_params

pygsti.modelmembers.operations.denseop.check_deriv_wrt_params#

check_deriv_wrt_params(operation, deriv_to_check=None, wrt_filter=None, eps=1e-07)#

Checks the deriv_wrt_params method of a LinearOperator object.

This routine is meant to be used as an aid in testing and debugging operation classes by comparing the finite-difference Jacobian that should be returned by operation.deriv_wrt_params with the one that actually is. A ValueError is raised if the two do not match.

Parameters:
  • operation (LinearOperator) – The operation 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, operation.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 filter the result by (as though derivative is only taken with respect to these parameters).

  • eps (float, optional) – The finite difference step to use.

Return type:

None