R/zinterface.R
autodiff.Rd
These functions calculate gradient, jacobian or hessian for the target function.
ad_jacobian(func, x, ..., mode = c("reverse", "forward"), debug = TRUE) ad_hessian(func, x, ..., mode = c("reverse", "forward"), debug = TRUE) ad_grad(func, x, ..., mode = c("reverse", "forward"), debug = TRUE) ad_deriv(func, x, ..., mode = c("reverse", "forward"), debug = TRUE)
func | the target function to calculate gradient, jacobian or hessian. |
---|---|
x | the input(s) where derivative is (are) taken. |
... | other arguments passed to the target function |
mode | whether to use forward or reverse mode automatic differentiation. |
debug | Whether to activate debug mode. With the debug mode, users can have more informative error messages. Without the debug mode, the functions will be more performant. |
if x
is given, then return will be derivatives;
if x
is not given, then return will be a function to calculate derivatives.