Skip to content

Installation

Add the facade crate to your Cargo.toml:

[dependencies]
numra = "0.1"

This gives you access to all Numra components through a single dependency. The facade crate re-exports everything under organized namespaces:

use numra::ode::{DoPri5, Solver, OdeProblem, SolverOptions};
use numra::optim::{bfgs_minimize, OptimOptions};
use numra::linalg::{DenseMatrix, Matrix};
use numra::dsp::butter; // signal processing
use numra::fft;
use numra::stats;
// ... and more

If you only need specific functionality, depend on individual crates to minimize compile times:

[dependencies]
# Just ODE solvers
numra-ode = "0.1"
# Just linear algebra
numra-linalg = "0.1"
# Just FFT
numra-fft = "0.1"

The crate hierarchy ensures you only pull in what you need:

numra-core (always required -- Scalar, Vector traits)
numra-linalg (adds matrices, factorizations)
numra-nonlinear (adds Newton solver)
numra-ode (adds ODE solvers)
numra-sde (adds SDE solvers, independent of numra-ode)

Numra requires Rust 2021 edition (1.56+). We recommend using the latest stable release for best performance.

The numra-core crate supports no_std:

[dependencies]
numra-core = { version = "0.1", default-features = false }

With default-features = false, the std feature is disabled and numra-core uses libm for all math functions. This is suitable for embedded targets.

Create a simple test to verify everything works:

use numra::ode::{DoPri5, Solver, OdeProblem, SolverOptions};
fn main() {
// Solve dy/dt = -y, y(0) = 1 (exact solution: y = e^(-t))
let problem = OdeProblem::new(
|_t, y: &[f64], dydt: &mut [f64]| { dydt[0] = -y[0]; },
0.0, 1.0, vec![1.0],
);
let options = SolverOptions::default();
let result = DoPri5::solve(&problem, 0.0, 1.0, &[1.0], &options).unwrap();
let y_final = result.y_final().unwrap()[0];
let exact = (-1.0_f64).exp();
println!("Computed: {y_final:.10}");
println!("Exact: {exact:.10}");
println!("Error: {:.2e}", (y_final - exact).abs());
}

You should see an error on the order of 1e-7 or smaller.

Numra’s key external dependencies:

DependencyVersionPurpose
faer0.20Linear algebra backend
rustfft6.2FFT backend
libm0.2no_std math functions
rand0.8Random number generation
thiserror1.0Error handling
rayon1.10Parallel Monte Carlo

All dependencies are pure Rust. No system libraries, C compilers, or LAPACK installations are needed.