1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
//! This crate aims to be a functional //! port of the Math.NET Numerics Distribution package and in doing so providing the Rust numerical //! computing community with a robust, well-tested statistical distribution package. This crate //! also ports over some of the special statistical functions from Math.NET in so far as they are //! used in the computation of distribution values. This crate depends on the `rand` crate to provide //! RNG. //! //! # Example //! The following example samples from a standard normal distribution //! //! ``` //! # extern crate rand; //! # extern crate statrs; //! use rand::StdRng; //! use statrs::distribution::{Distribution, Normal}; //! //! # fn main() { //! let mut r = rand::StdRng::new().unwrap(); //! let n = Normal::new(0.0, 1.0).unwrap(); //! for _ in 0..10 { //! print!("{}", n.sample::<StdRng>(&mut r)); //! } //! # } //! ``` #![crate_type = "lib"] #![crate_name = "statrs"] extern crate rand; #[macro_export] macro_rules! assert_almost_eq { ($a:expr, $b:expr, $prec:expr) => ( if !$crate::prec::almost_eq($a, $b, $prec) { panic!(format!("assertion failed: `abs(left - right) < {:e}`, (left: `{}`, right: `{}`)", $prec, $a, $b)); } ); } pub mod distribution; pub mod euclid; pub mod function; pub mod generate; pub mod consts; pub mod prec; pub mod statistics; mod result; mod error; #[cfg(test)] mod testing; pub use result::Result; pub use error::StatsError;