FastAD is aheader-only C++ template library for automatic differentiationsupporting both forward and reverse mode. It utilizes the latestfeatures in C++17 and expression templates for efficient computation.See theFastAD repofor more.
This package brings this header-only library to R so that other Ruser can access it simply by addingLinkingTo: RcppFastAD.
Three examples, taken from FastAS, are included. We can look at theblack_scholes() one here:
>library(RcppFastAD)>black_scholes() value delta vega rho thetacall56.51360.7738189.054932.03321275.730put51.4109-0.2261829.05493-6.17753274.481>This evaluates a put and a call struck at 100 with spot at 105, andsome default values (all taken fromanexample included with Boost). The values can be set in the call too.Returned all the value along the first partial derivatives relative tospot, volatility, short rate and time to maturity—which are allcalculated using automatic differentiation.
(FastAD has a focus on speed leading to some design choices that maketakingsecond derivatives harder. So no ‘gamma’ here.)
The package is complete and contains a mature version of FastAD.
Any problems, bug reports, or features requests for the package canbe submitted and handled most conveniently asGithubissues in the repository.
Before submitting pull requests, it is frequently preferable to firstdiscuss need and scope in such an issue ticket. See the fileContributing.md(in theRcpp repo) for abrief discussion.
For the R package,DirkEddelbuettel.
For everything pertaining to FastAD:James Yang.
Initially created: Sun Mar 5 05:12:59 PM CST 2023
Last modified: Sun May 26 10:12:05 CDT 2024