Crate mkv_chain

Source
Expand description

A Markov chain is a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event.

§Example

    let t_mat = Matrix3::new(  // Transition Matrix
      [[0.9, 0.0, 0.1],
       [0.1, 0.3, 0.6],
       [0.0, 0.1, 0.9]],
   );
   let initial = Vec3::new([0.1, 0.3, 0.6]); // Initial State
   let mvc = MarkovChain3::from(t_mat, initial);
   assert_eq!(
       mvc.take_to(3),
       Vec3::new([0.12250000000000001, 0.11130000000000001, 0.7662])
   );

Modules§

linalg
Algebra module for MarkovChains.

Macros§

markovchain
Generate a markov chain from matrix and vec identifiers.
matrix
Generate code for a quare matrix with name, order and inner type
vector
Generate code for a vector with name and order

Structs§

MarkovChain2
! MarkovChain with two nodes. ! ! - Transition graph is a Matrix2 ! - Initial state is a Vec2
MarkovChain3
! MarkovChain with three nodes. ! ! - Transition graph is a Matrix3 ! - Initial state is a Vec3
MarkovChain4
! MarkovChain with four nodes. ! ! - Transition graph is a Matrix4 ! - Initial state is a Vec4
MarkovChain5
! MarkovChain with five nodes. ! ! - Transition graph is a Matrix5 ! - Initial state is a Vec5
MarkovChain6
! MarkovChain with six nodes. ! ! - Transition graph is a Matrix6 ! - Initial state is a Vec6