jabr / gillrocky

An implementation of the Gillespie algorithm.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gillrocky

Rocket Gillespie

An implementation of the Gillespie algorithm in Rust.

a discrete, stochastic process instead of a continuous, deterministic process[a]

Example

cargo build
cargo run
use gillrocky::{Reactor, Process};

struct State { ... }
struct Reaction { ... }

impl Process<State> for Reaction {
  fn rate(&self, state: &State) -> f64 { ... }
  fn perform(&mut self, state: &mut State) { ... }
}

let mut reactor = Reactor::new(seed);
reactor.add(Reaction { ... });
reactor.add(Reaction { ... });

let state = State { ... };
loop {
  reactor.step(&mut state);
  // output: reactor.time, state.*, etc
}

See also

References

License

This project is licensed under the terms of the MIT license.

Icon derived from work by Selman Design.

About

An implementation of the Gillespie algorithm.

License:MIT License


Languages

Language:Rust 100.0%