pub struct DiscreteGuideTable { /* private fields */ }Expand description
Inversion by guide table (SciPy’s DiscreteGuideTable): the cumulative probabilities are
searched from a table that says where to start for each of guide_factor × n equal slices of
[0, 1), so the expected search length is a small constant.
Implementations§
Source§impl DiscreteGuideTable
impl DiscreteGuideTable
Sourcepub fn new(pmf: &[f64], guide_factor: f64) -> Result<Self, ErrorsJSL>
pub fn new(pmf: &[f64], guide_factor: f64) -> Result<Self, ErrorsJSL>
guide_factor is SciPy’s default of 1.
Sourcepub fn ppf(&self, u: f64) -> usize
pub fn ppf(&self, u: f64) -> usize
The outcome for the uniform value u ∈ [0, 1): the first k with cdf[k] > u.
pub fn rvs_one<G: UniformGenerator>(&self, rng: &mut G) -> usize
pub fn rvs<G: UniformGenerator>(&self, n: usize, rng: &mut G) -> Vec<usize>
Sourcepub fn qrvs_sobol(&self, n: usize) -> Vec<usize>
pub fn qrvs_sobol(&self, n: usize) -> Vec<usize>
n variates by inversion of the first points of the (unscrambled, one-dimensional) Sobol
sequence, a quasi-Monte Carlo sample (SciPy’s qrvs). The sequence starts at 0, which
is skipped.
Trait Implementations§
Source§impl Clone for DiscreteGuideTable
impl Clone for DiscreteGuideTable
Auto Trait Implementations§
impl Freeze for DiscreteGuideTable
impl RefUnwindSafe for DiscreteGuideTable
impl Send for DiscreteGuideTable
impl Sync for DiscreteGuideTable
impl Unpin for DiscreteGuideTable
impl UnsafeUnpin for DiscreteGuideTable
impl UnwindSafe for DiscreteGuideTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more