This crate is inspired by Boost::Accumulator which supports incremental statistical computation (online algorithms). This is a work in progress but usable. Please write integration tests before using it in production.
Read Documentation
- 2023-12-20: Version 0.6 is a major rewrite that fix many embarassing bugs. In 0.6+, we are relying on watermill crate for underlying algorithms.
use simple_accumulator::SimpleAccumulator;
fn main() {
let k = [1, 2, 3, 4];
// If second argument is `None` then accumulator stores all the data.
let mut x = SimpleAccumulator::new(&k, Some(10));
println!("{:?}", x);
x.push(5);
println!("{:?}", x);
print!("{}", x.mean());
print!("{}", x.median());
print!("{}", x.variance());
print!("{}", x.sum());
print!("{}", x.kurtosis());
...
}