15 breaking releases

0.16.0 Aug 1, 2025
0.15.0 Jun 24, 2024
0.14.0 Jan 16, 2023
0.13.0 May 2, 2022
0.1.1 Sep 26, 2019

#298 in Science

Download history 298/week @ 2025-12-28 101/week @ 2026-01-04 115/week @ 2026-01-11 167/week @ 2026-01-18 716/week @ 2026-01-25 719/week @ 2026-02-01 439/week @ 2026-02-08 87/week @ 2026-02-15 487/week @ 2026-02-22 410/week @ 2026-03-01 423/week @ 2026-03-08 118/week @ 2026-03-15 92/week @ 2026-03-22 692/week @ 2026-03-29 215/week @ 2026-04-05 141/week @ 2026-04-12

1,152 downloads per month

MIT/Apache

18KB
277 lines

nalgebra-mvn

Crates.io

Multivariate normal distribution using nalgebra.

Example of usage

use nalgebra::{ Vector2, Matrix2, OMatrix, U2, U3};
use nalgebra_mvn::MultivariateNormal;

// specify mean and covariance of our multi-variate normal
let mu = Vector2::from_row_slice(&[9.0, 1.0]);
let sigma = Matrix2::from_row_slice(
    &[1.0, 0.0,
    0.0, 1.0]);

let mvn = MultivariateNormal::from_mean_and_covariance(&mu, &sigma).unwrap();

// input samples are row vectors vertically stacked
let xs = OMatrix::<_,U3,U2>::new(
    8.9, 1.0,
    9.0, 1.0,
    9.1, 1.0,
);

// evaluate the density at each of our samples.
let result = mvn.pdf(&xs);

// result is a vector with num samples rows
assert!(result.nrows()==xs.nrows());

License

Licensed under either of

at your option.

License: MIT/Apache-2.0

Dependencies

~3MB
~65K SLoC