Is there some good multivariate gaussian generator?

Dear all, a quick question,

Is there some good multivariate gaussian generator?
Or, like, what multivariate gaussian generator do you use?
You know, it should be able to generate gaussian random vector with covariance or something.

Key word
multivariate

Is Alan Miller’s random.f90 OK for multivariate gaussian generator?
https://jblevins.org/mirror/amiller/random.f90

Alan Miller and John Burkardt are two big names! Like Tom and Jerry!

Thank you very much in advance!

I think this algorithm works directly with the covariance matrix (as input argument) which makes it nice and rather easy to work with, but not the most efficient for repeated random-number generations from the same distribution. As I said before in another comment, the most efficient method is to pass the Cholesky factorization to the procedure rather than passing the covariance matrix (which would require the factorization computation on each and every call to the procedure). Here is an implementation that takes the Cholesky Factorization instead of the covariance matrix.

2 Likes

You are probably going to be asking many such similar questions. I am going to put in a link to a NAG Library routine here

https://www.nag.com/numeric/nl/nagdoc_latest/flhtml/g05/g05rzf.html

One advantage of using a tested numerical library is that your program will not be an aggregate of codes of variable quality, provenance and robustness. The source you (or others) linked to could be impeccable but where is the test program that gives you confidence that the compiler, with the custom compiler options that you throw at it, did not mess it up? Our makefiles at NAG are littered with special cases for which reduced optimization is necessary for some versions of each compiler. I think readers of this thread should be aware of such issues.

3 Likes