pygsti.optimize.check_jac¶
-
pygsti.optimize.
check_jac
(f, x0, jacToCheck, eps=1e-10, tol=1e-06, errType='rel')¶ Checks a jacobian function using finite differences.
Parameters: - f (function) – The function to check.
- x0 (numpy array) – The point at which to check the jacobian.
- jacToCheck (function) – A function which should compute the jacobian of f at x0.
- eps (float, optional) – Epsilon to use in finite difference calculations of jacobian.
- tol (float, optional) – The allowd tolerance on the relative differene between the values of the finite difference and jacToCheck jacobians if errType == ‘rel’ or the absolute difference if errType == ‘abs’.
Returns: - errSum (float) – The total error between the jacobians.
- errs (list) – List of (row,col,err) tuples giving the error for each row and column.
- ffd_jac (numpy array) – The computed forward-finite-difference jacobian.