pub struct ContinuousTimeMarkov {
pub states: usize,
pub generator: Vec<Vec<f64>>,
}Expand description
Continuous-time Markov chain defined by a generator matrix Q. Q[i][j] >= 0 for i != j, Q[i][i] = -sum_{j!=i} Q[i][j].
Fields§
§states: usize§generator: Vec<Vec<f64>>Implementations§
Source§impl ContinuousTimeMarkov
impl ContinuousTimeMarkov
pub fn new(generator: Vec<Vec<f64>>) -> Self
Sourcepub fn holding_time(&self, state: usize, rng: &mut Rng) -> f64
pub fn holding_time(&self, state: usize, rng: &mut Rng) -> f64
Holding time in state i: Exp(-Q[i][i]).
Sourcepub fn jump_prob(&self, from: usize, to: usize) -> f64
pub fn jump_prob(&self, from: usize, to: usize) -> f64
Jump probability from state i to state j (given that a jump occurs).
Sourcepub fn simulate(
&self,
rng: &mut Rng,
initial: usize,
duration: f64,
) -> Vec<(f64, usize)>
pub fn simulate( &self, rng: &mut Rng, initial: usize, duration: f64, ) -> Vec<(f64, usize)>
Simulate the CTMC: returns Vec of (time, state).
Sourcepub fn embedded_chain(&self) -> MarkovChain
pub fn embedded_chain(&self) -> MarkovChain
Compute the embedded discrete-time chain’s transition matrix.
Sourcepub fn stationary_distribution(&self) -> Vec<f64>
pub fn stationary_distribution(&self) -> Vec<f64>
Stationary distribution via solving pi * Q = 0 using power iteration on the embedded chain weighted by holding times.
Auto Trait Implementations§
impl Freeze for ContinuousTimeMarkov
impl RefUnwindSafe for ContinuousTimeMarkov
impl Send for ContinuousTimeMarkov
impl Sync for ContinuousTimeMarkov
impl Unpin for ContinuousTimeMarkov
impl UnsafeUnpin for ContinuousTimeMarkov
impl UnwindSafe for ContinuousTimeMarkov
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.