Provides an interface from R to the 'autodiff' library < https://autodiff.github.io/>, a modern header-only C++ library for automatic differentiation. Unlike numerical differentiation, automatic differentiation computes derivatives of functions to machine precision without truncation error, using either forward or reverse mode. The 'autodiff' header files are shipped with this package so that other R packages can use them by including 'Rcppautodiff' in the 'LinkingTo' field of their 'DESCRIPTION' file. Example programs demonstrate computing derivatives of single-variable and multi-variable functions, gradient vectors, Jacobian matrices and derivatives with respect to parameters, using 'Rcpp' and 'RcppEigen'.
An R interface to the autodiff C++ library using Rcpp. autodiff is a modern, header-only C++17 library which provides an efficient and simple interface to perform automatic differentiation in C++. autodiff supports both forward and reverse mode of automatic differentiation. Rcppautodiff brings these capabilities to R. For more details on the autodiff library, please see its documentation and tutorials.
The vignette of this package also reproduces a number of examples from the autodiff library in R using Rcpp.
Rcppautodiff is not on CRAN yet. It can be installed from github using the following command in the R console.
pak::pkg_install('sn248/Rcppautodiff')
See the package vignette for a variety of examples.
This package would not exist without the wonderful autodiff, a modern, fast and expressive C++ library for automatic differentiation (by Allan M. M. Beal), found at https://autodiff.github.io/