4 releases

0.3.1 Oct 7, 2019
0.3.0 Oct 7, 2019
0.2.2 Oct 6, 2019
0.2.1 Oct 6, 2019

#18 in Encoding

27 downloads per month

Custom license

16KB
293 lines

mkv_chain Build Status Latest Version Rust Documentation

Stochastic Oriented Markov Chain Crate

[dependencies]
mkv_chain="0.3.1"

Example

extern crate mkv_chain;
use mkv_chain::{MarkovChain3, linalg::{Matrix3, Vec3}};
fn main() {
  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])
 );
}

Dependencies

~200KB