Question

I can sample from a normal distribution using Boost in c++.

I have now a simple question:

How can i sample from a multivariate normal distribution (n>2) using Boost functions (normal distribution, multi-arrays...) ?

Was it helpful?

Solution

I think you won't be able to do this without a little bit of linear algebra. Effectively, if you have a covariance matrix C, you can generate an upper triangular matrix L using Cholesky Decomposition such that C = L*L^T. This matrix L can be used now to generate a sample from the distribution with covariance C, by applying L to a vector of uncorrelated noise.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top