13 breaking releases

0.14.0 Jan 16, 2023
0.13.0 May 2, 2022
0.12.0 Jan 2, 2022
0.11.0 Aug 11, 2021
0.1.1 Sep 26, 2019

#253 in Science

Download history 346/week @ 2023-12-11 246/week @ 2023-12-18 69/week @ 2023-12-25 82/week @ 2024-01-01 108/week @ 2024-01-08 205/week @ 2024-01-15 534/week @ 2024-01-22 629/week @ 2024-01-29 621/week @ 2024-02-05 276/week @ 2024-02-12 268/week @ 2024-02-19 499/week @ 2024-02-26 531/week @ 2024-03-04 328/week @ 2024-03-11 210/week @ 2024-03-18 272/week @ 2024-03-25

1,384 downloads per month

MIT/Apache

17KB
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
~57K SLoC