pub struct NumericalInverseHermite<'a> { /* private fields */ }Expand description
Numerical inversion of a distribution function by cubic Hermite interpolation of its inverse
(SciPy’s NumericalInverseHermite; Hörmann and Leydold’s HINV). The interval (a, b) is
split until, on every piece, the cubic that matches x and dx/du = 1/f(x) at both ends
inverts F to within u_resolution: |F(x̂(u)) − u| ≤ ε at the middle of the piece. The
pieces are then a table, and a variate or a quantile costs a search and a cubic.
Implementations§
Source§impl<'a> NumericalInverseHermite<'a>
impl<'a> NumericalInverseHermite<'a>
Sourcepub fn new(
cdf: impl Fn(f64) -> f64 + 'a,
pdf: impl Fn(f64) -> f64 + 'a,
domain: (f64, f64),
center: f64,
u_resolution: f64,
) -> Result<Self, ErrorsJSL>
pub fn new( cdf: impl Fn(f64) -> f64 + 'a, pdf: impl Fn(f64) -> f64 + 'a, domain: (f64, f64), center: f64, u_resolution: f64, ) -> Result<Self, ErrorsJSL>
cdf and pdf on domain (infinite ends are cut where the tail probability is below
u_resolution / 10); center is a point inside the distribution (SciPy’s center).
Sourcepub fn n_intervals(&self) -> usize
pub fn n_intervals(&self) -> usize
The number of intervals of the table.
Sourcepub fn ppf(&self, u: f64) -> f64
pub fn ppf(&self, u: f64) -> f64
The quantile function: x with F(x) = u, 0 ≤ u ≤ 1 (SciPy’s ppf).
pub fn rvs_one<G: UniformGenerator>(&self, rng: &mut G) -> f64
pub fn rvs<G: UniformGenerator>(&self, n: usize, rng: &mut G) -> Vec<f64>
Sourcepub fn qrvs_sobol(&self, n: usize) -> Vec<f64>
pub fn qrvs_sobol(&self, n: usize) -> Vec<f64>
n variates by inversion of the first points of the (unscrambled, one-dimensional) Sobol
sequence (SciPy’s qrvs); their empirical distribution function converges to F like
(log n)/n, not n^{-1/2}. The sequence starts at 0, which is skipped.