check.derivatives function

Check analytic gradients of a function using finite difference approximations