Function lupnt::SampleMvNormal

Function Documentation

MatX lupnt::SampleMvNormal(const VecX &mean, const MatX &cov, int nn = 1, std::mt19937 *rng = nullptr)

Draw nn samples from a multivariate normal distribution N(mean, cov).

Used by measurement-simulation and filter-test code (e.g. example_adaptive.cc) to generate synthetic state/measurement-error realizations from a given covariance matrix, via a Cholesky factorization of cov.

Parameters:
  • mean – Mean vector [size n]

  • cov – Covariance matrix [size n x n], must be positive-definite

  • nn – Number of samples to draw (default 1)

  • rng – Optional random engine; defaults to lupnt::RandomEngine::Get()

Returns:

nn x n matrix, each row a sample from N(mean, cov)