1

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...) ?

khelkhel
  • 37
  • 1
  • 7
  • I have never done this kind of thing, but [this](http://lists.boost.org/boost-users/att-64979/multivariate_normal_distribution.hpp) might help... – niktehpui Apr 04 '12 at 09:40
  • What exactly is the problem? You can simply generate the normal distribution for each axis with the given means and variants. (If the are not correlated) – unsym Apr 04 '12 at 09:44
  • 1
    what if they are correlated??? – khelkhel Apr 04 '12 at 12:06

1 Answers1

1

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.

Jakob
  • 2,360
  • 15
  • 21