从FORTRAN中的截断正态分布生成伪随机数 [英] pseudorandom number generation from truncated normal distribution in FORTRAN
问题描述
我正在尝试使用FORTRAN从左截断的正态分布中绘制伪随机数.我希望函数返回与输入相同尺寸的值:
I am trying to draw pseudo random numbers from a left-truncated normal distribution using FORTRAN. I want the function to return values with the same dimension as inputs:
功能(MU,SIGMA); mu = N x 1且SIGMA = N X 1
FUNCTION (MU, SIGMA) ; mu=N x 1 and SIGMA = N X 1
有人可以帮忙吗? 预先感谢
Can someone help please? Thanks in advance
推荐答案
Perhaps use the GNU Scientific Library and the Fortran interface thereto: http://www.lrz.de/services/software/mathematik/gsl/fortran/. The GSL has a random normal generator. Reject and try again if the number is on the wrong side. The easiest method is to put it all in a loop and use the underlying random number generator in a serial manner. Multi-threaded random numbers are subtle to get right.
这篇关于从FORTRAN中的截断正态分布生成伪随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!