pub struct NonHomogeneousPoisson {
pub rate_fn: Box<dyn Fn(f64) -> f64>,
pub rate_max: f64,
}Expand description
Non-homogeneous Poisson process with time-varying rate function lambda(t).
Fields§
§rate_fn: Box<dyn Fn(f64) -> f64>Rate function lambda(t).
rate_max: f64Upper bound on the rate function (for thinning algorithm).
Implementations§
Source§impl NonHomogeneousPoisson
impl NonHomogeneousPoisson
pub fn new(rate_fn: Box<dyn Fn(f64) -> f64>, rate_max: f64) -> Self
Sourcepub fn arrivals(&self, rng: &mut Rng, duration: f64) -> Vec<f64>
pub fn arrivals(&self, rng: &mut Rng, duration: f64) -> Vec<f64>
Generate arrival times using the thinning (Lewis-Shedler) algorithm.
- Generate candidate arrival from homogeneous Poisson(rate_max)
- Accept with probability lambda(t) / rate_max
Sourcepub fn counting_path(&self, rng: &mut Rng, duration: f64) -> Vec<(f64, usize)>
pub fn counting_path(&self, rng: &mut Rng, duration: f64) -> Vec<(f64, usize)>
Generate counting process path.
Sourcepub fn expected_count(&self, duration: f64, n_points: usize) -> f64
pub fn expected_count(&self, duration: f64, n_points: usize) -> f64
Expected number of arrivals in [0, t] = integral of lambda(s) ds. Computed via simple trapezoidal rule.
Auto Trait Implementations§
impl Freeze for NonHomogeneousPoisson
impl !RefUnwindSafe for NonHomogeneousPoisson
impl !Send for NonHomogeneousPoisson
impl !Sync for NonHomogeneousPoisson
impl Unpin for NonHomogeneousPoisson
impl UnsafeUnpin for NonHomogeneousPoisson
impl !UnwindSafe for NonHomogeneousPoisson
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.