从FORTRAN中的截断正态分布生成伪随机数 [英] pseudorandom number generation from truncated normal distribution in FORTRAN

查看:167
本文介绍了从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

推荐答案

也许使用GNU科学库及其Fortran接口:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆