https://github.com/eddelbuettel/rcppfastad
Rcpp Bindings to FastAD Automatic Differentiation
https://github.com/eddelbuettel/rcppfastad
Last synced: 4 months ago
JSON representation
Rcpp Bindings to FastAD Automatic Differentiation
- Host: GitHub
- URL: https://github.com/eddelbuettel/rcppfastad
- Owner: eddelbuettel
- Created: 2023-02-16T02:23:24.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2026-01-19T03:33:50.000Z (5 months ago)
- Last Synced: 2026-01-19T12:48:06.400Z (5 months ago)
- Language: C++
- Size: 87.9 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
Awesome Lists containing this project
README
## RcppFastAD: Rcpp Bindings for the FastAD C++ Header-Only Library
[](https://github.com/eddelbuettel/rcppfastad/actions?query=workflow%3Aci)
[](https://www.gnu.org/licenses/gpl-2.0.html)
[](https://cran.r-project.org/package=RcppFastAD)
[](https://cran.r-project.org/package=RcppFastAD)
[](https://github.com/eddelbuettel/rcppfastad)
### Motivation
[FastAD](https://github.com/JamesYang007/FastAD) is a header-only C++ template library for automatic differentiation
supporting both forward and reverse mode. It utilizes the latest features in C++17 and expression templates for
efficient computation. See the [FastAD](https://github.com/JamesYang007/FastAD) repo for more.
This package brings this header-only library to R so that other R user can access it simply by
adding `LinkingTo: RcppFastAD`.
### Example
Three examples, taken from FastAD, are included. We can look at the `black_scholes()` one here:
```r
> library(RcppFastAD)
> black_scholes()
value delta vega rho theta
call 56.5136 0.773818 9.05493 2.03321 275.730
put 51.4109 -0.226182 9.05493 -6.17753 274.481
>
```
This evaluates a put and a call struck at 100 with spot at 105, and some default values (all taken from [an example
included with Boost](https://www.boost.org/doc/libs/master/libs/math/doc/html/math_toolkit/autodiff.html#math_toolkit.autodiff.example-black_scholes)).
The values can be set in the call too. Returned all the value along the first partial derivatives relative to spot,
volatility, short rate and time to maturity---which are all calculated using automatic differentiation.
(FastAD has a focus on speed leading to some design choices that make taking _second_ derivatives harder. So no 'gamma' here.)
### Status
The package is complete and contains a mature version of FastAD.
### Contributing
Any problems, bug reports, or features requests for the package can be submitted and handled most
conveniently as [Github issues](https://github.com/eddelbuettel/rcppfastAD/issues) in the
repository.
Before submitting pull requests, it is frequently preferable to first discuss need and scope in such
an issue ticket. See the file
[Contributing.md](https://github.com/RcppCore/Rcpp/blob/master/Contributing.md) (in the
[Rcpp](https://github.com/RcppCore/Rcpp) repo) for a brief discussion.
### Authors
For the R package, [Dirk Eddelbuettel](https://github.com/eddelbuettel).
For everything pertaining to FastAD: [James Yang](https://github.com/JamesYang007).