| Linux | Codecov | | :---------------: | :-------------------: | | ![lin-badge] | ![cov-badge] |
Implements Fang-Oosterlee algorithm in Rust. While the algorithm originally was used for option pricing, it can be used for a variety of use cases. For example, it can be used to compute the Value at Risk of a distribution, the density of a distribution, and the partial expectation.
It requires a characteristic function computed at various specific intervals. A utility function is provided which converts an analytical characteristic function into a vector.
Documentation is at docs.rs
Put the following in your Cargo.toml:
toml
[dependencies]
fang_oost = "0.15"
Import and use:
```rust extern crate numcomplex; extern crate fangoost; extern crate rayon; use rayon::prelude::*; use num_complex::Complex;
let numx = 1024;
let numu = 256;
let xmin = -20.0;
let xmax = 25.0;
let mu=2.0;
let sigma:f64=5.0;
let normcf = |u:&Complex
View benchmarks at https://danielhstahl.github.io/fangoostrust/report/index.html.