Function lupnt::SampleMvNormal¶
Defined in File math_utils.cc
Function Documentation¶
-
MatX lupnt::SampleMvNormal(const VecX &mean, const MatX &cov, int nn = 1, std::mt19937 *rng = nullptr)¶
Draw
nnsamples from a multivariate normal distributionN(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 ofcov.- 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 nmatrix, each row a sample fromN(mean, cov)