Skip to content
/ rad Public

Algorithmic Differentiation (AutoDiff) in R with Rcpp and CppAD

Notifications You must be signed in to change notification settings

mkomod/rad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rad

Some C++ autodiff (AD) examples with binding to R through Rcpp.

Different examples have been put together showcasing AD.

Example 1

Computes the derivative of

f(x) = 3x^2 + 2x + 2

Source

Example 2

Computes the derivative of a function with two input variables

f(x_1, x_2) = exp(3x_1 + 4 + x_2^2)

Source

Example 3

Computes the derivative of the normal density, and compares the performance to the analytical solution. AD generated derivatives are about 10x slower

Source

Example 4

We introduce the Adept AD library and compare it to CppAD. CppAD is about twice as fast.

Source

Example 5

We compute the Jacobian and Hessian of a function taking a vector as input.

Source

Example 6

We provide a general class for defining functions and computing their derivatives. We showcase how the class can be used with R's optimisers to find the minimum of a function.

Source

About

Algorithmic Differentiation (AutoDiff) in R with Rcpp and CppAD

Topics

Resources

Stars

Watchers

Forks

Languages