pygsti.modelmembers.operations.linearop.finite_difference_hessian_wrt_params#
- finite_difference_hessian_wrt_params(operation, wrt_filter1, wrt_filter2, eps=0.0001)#
Computes a finite-difference Hessian for a LinearOperator object.
The returned value is a tensor whose leading dimension corresponds to the elements of the flattened operation matrix, and whose remaining two dimensions correspond to derivatives with respect to the operations parameters (potentially filtered). This matches the format expected from the operation’s hessian_wrt_params method.
- Parameters:
operation (LinearOperator) – The operation object to compute a Hessian for.
wrt_filter1 (list or numpy.ndarray) – List of parameter indices to filter the result by (as though the 1st derivative is only taken with respect to these parameters).
wrt_filter2 (list or numpy.ndarray) – List of parameter indices to filter the result by (as though the 2nd derivative is only taken with respect to these parameters).
eps (float, optional) – The finite difference step to use.
- Returns:
An M by N1 by N2 tensor where M is the number of operation elements and N1 and N2 are numbers of operation parameters.
- Return type:
numpy.ndarray