#![deny(missing_docs)]
#![allow(non_upper_case_globals)]
extern crate approx;
extern crate nalgebra;
extern crate rand;
extern crate regex;
pub mod prelude;
pub mod gfi;
pub mod address;
pub mod trie;
pub mod modeling;
pub mod inference;
pub fn logsumexp(xs: &Vec<f64>) -> f64 {
let max = xs.iter().cloned().fold(-1./0. , f64::max);
if max == f64::NEG_INFINITY {
f64::NEG_INFINITY
} else {
let mut sum_exp = 0.;
for x in xs {
sum_exp += (x - max).exp();
}
max + sum_exp.ln()
}
}
pub use trie::Trie;
pub use address::{SplitAddr, AddrMap, normalize_addr};
pub use gfi::{Trace, GenFn, ArgDiff};
pub use modeling::dists::{
u01,Distribution,
bernoulli,
uniform_continuous,
uniform,
uniform_discrete,
categorical,
normal,
mvnormal,
geometric,
poisson,
gamma,
beta
};
pub use modeling::dyngenfn::{DynTrie,DynTrace,DynGenFn,DynGenFnHandler};
pub use modeling::dynunfold::{DynUnfold,DynParticles};
pub use inference::{importance_sampling, importance_resampling};
pub use inference::{metropolis_hastings, mh, regenerative_metropolis_hastings, regen_mh};
pub use inference::ParticleSystem;