本文介绍了从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接口: http://www.lrz.de/services/software/mathematik/gsl/fortran/. GSL具有随机法线生成器.拒绝并重试,如果号码错误.最简单的方法是将所有内容放在一个循环中,并以串行方式使用基础随机数生成器.多线程随机数很难正确设置.

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中的截断正态分布生成伪随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 14:33