compute
A crate for scientific and statistical computing. For a list of what this crate provides, see FEATURES.md
. For more detailed explanations, see the documentation.
To use the latest stable version in your Rust program, add the following to your Cargo.toml
file:
// Cargo.toml
compute = "0.1"
For the latest version, add the following to your Cargo.toml
file:
=
compute
There are many functions which rely on linear algebra methods. You can either use the provided Rust methods (default), or use BLAS and/or LAPACK. To do so, activate the "blas"
and/or the "lapack"
feature flags in Cargo.toml
:
// example with BLAS only
compute =
Examples
Statistical distributions
use *;
let beta = new;
let betadata: = b.sample_vec; // vector of 1000 variates
println!;
println!;
println!; // probability distribution function
let binom = new;
println!; // sample single value
println!; // probability mass function
Regression
use *;
let x = vec!;
let y = vec!;
let mut clf = new; // degree 1 (i.e. linear regressor)
clf.fit; // linear least squares fitting
println!; // get model coefficients
Time series models
use *;
let x = vec!;
let mut ar = AR new; // AR(1) model
ar.fit; // fit model with Yule-Walker equations
println!; // get model coefficients
println!; // forecast 5 steps ahead
Numerical integration
use *;
let f = ;
println!; // trapezoid integration with 100 segments
println!; // gaussian quadrature integration
println!; // romberg integration with tolerance and max steps
Linear algebra
use *;
let x = vec!;
let y = vec!;
println!; // calculate LU decomposition for x
println!; // solve 2x2 system of equations (each column of y is a system)
println!; // matrix multiply, transposing y
Data summary functions
use *;
let x = vec!;
let y = vec!;
println!;
println!;
println!;
println!;
println!;
Mathematical and statistical functions
use *;
println!;
println!