How to generate random samples according to a known covariance matrix and expectations?

I have the mean value of the N-dimensional distribution and the symmetric covariance matrix(N,N), how to generate samples that meet the above two requirements?

Hi,

You can use the function from the GSLRandomEngine class, see ROOT: ROOT::Math::GSLRandomEngine Class Reference

An example of using the class is this tutorial : ROOT: tutorials/math/multivarGaus.C File Reference

Note there is a memory leak in using this function in the current master and it should be fixed when this PR , [math][mathmore] Fix memory leak in GaussianND random function by lmoneta · Pull Request #12615 · root-project/root · GitHub, will be merged.

Lorenzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.