s***e 发帖数: 911 | 1
我把程序直接给你? 很短. 这个程序很好用. 其中有些注释句很多余,是以前我调程序
干的,没删掉. 是单精度实行.反正是random number, 没必要双精度. 主程序掉用强行
转一下就成.
FUNCTION ran2(idum)
c REAL FUNCTION ran2(idum)
INTEGER idum,IM1,IM2,IMM1,IA1,IA2,IQ1,IQ2,IR1,IR2,NTAB,NDIV
REAL ran2,AM,EPS,RNMX
* REAL*8 FUNCTION ran2(idum)
c REAL FUNCTION ran2(idum)
PARAMETER (IM1=2147483563,IM2=2147483399,AM=1./IM1,IMM1=IM1-1,
*IA1=40014,IA2=40692,IQ1=53668,IQ2=52774,IR1=12211,IR2=3791,
*NTAB=32,NDIV=1+IMM1/NTAB,EPS=1.2e-7,RNMX |
|
h***s 发帖数: 2499 | 2 计算中需要大量的gaussian random number,采用的nr里的ran2(),因为周期长...
看见有人说ran2()计算费时间,所以第一次计算的时候把ran2()产生的数都存下来,下
次换了参数run的时候就读取保存的数据...
想问问,是再次调用ran2()快还是读外部文件快啊? |
|
x********g 发帖数: 47 | 3 请高手指教 。 makefile如下:
# application name
APP = parallel_femsim
# list of source files
SRC = ran2.f90 globals.f90 model.f90 scattering_factors.f90 fem1.f90
parallel_femsim.f90
# list of object files
OBJ = ran2.o globals.o model.o scattering_factors.o fem1.o parallel_femsim
.o
# define libraries needed by the linker
#LIBS = -lmkl
# compiler options for debugging
FC_DEBUG = mpif90 -g -debug -implicitnone
# compiler options for optmized running
#FC_OPT = ifort -O3 -xO -ipo -no-prec-div -static
#F |
|
s**g 发帖数: 3271 | 4 last night, we are talking about this and I asked 2bao whether he wants to
use the nickname ran2 ran2, he refused
heng |
|
c******n 发帖数: 4965 | 5 a search on wikipedia shows the difference
"chive" is really tiny green onions,
JIU3 CAI4 is completely different, its leaves are not tubular, like onions.
it's a native Chinese plant, so westerners translated it to
"chinese chives" or "garlic chives", such translations always cause problems
, they should simply adopt the pronounciation, like we did for
Zi1 Ran2 |
|
a*****e 发帖数: 16445 | 6 guo3 ran2 shi4 包子大户, zai4 pai2 10 huang2 bao1! |
|
p**w 发帖数: 62 | 7 haha, gang1 cai2 cai2 fa1 xian4 wo3 ju1 ran2 qiang3 dao4 le 7000,
hahaha |
|
s**********n 发帖数: 2601 | 8 of course, I 会做 everything.
yao4 bu4 ran2 zen3 me shuo1 wo3 bi3 SS xian2 hui4 ne~~ |
|
|
j**4 发帖数: 10425 | 10 tu1 ran2 fa1 xian4, wo3 dui4 liang3 jian4 shi4, bu4 gan3 mao4: one is money,
and the other is marriage certificate... |
|
j**4 发帖数: 10425 | 11 hao3 xiang3 mai4 ying2... |
|
|
j**4 发帖数: 10425 | 13 maybe charge accordingly. if u r old and poor, maybe just a dollar... if u
r gao1 fu4 shuai4, then maybe $1,000,000 |
|
m*******y 发帖数: 14292 | 14 then you need to have your salon photo taken first. please contact Hao. |
|
m*****5 发帖数: 23482 | 15 she said she wanted to sell silver |
|
|
|
m*****5 发帖数: 23482 | 18
u know, beef comes from a place with no "g" |
|
|
j**4 发帖数: 10425 | 20 i am going for modeling.. there are plenty uglier prostitutes than me |
|
j**4 发帖数: 10425 | 21 that's why i always attach a 'g' just in case... |
|
m*******y 发帖数: 14292 | 22 smart girl. i can hook you up with my hudsband he orders models pretty
frequently for their company parties and stuff. |
|
j**4 发帖数: 10425 | 23 sorry, i meant to say "i am NOT going for modeling..." |
|
|
j**4 发帖数: 10425 | 25 john bohner is kind of hot, and he cries a lot, even hotter |
|
|
|
H***e 发帖数: 471 | 28 ZAI4 Canada ZHU4 GUO4 N DUO1 NIAN2, DAN4 SHI4 MEI2 YOU3 ZHU4 GUO4 Toronto DE
REN2 AN4 RAN2 PIAO1 GUO4.
506 |
|
|
h*i 发帖数: 27 | 30 It seems that almost everyone knows Marques's
"One Hundred Years of Solitude".
Somehow sadness literature expresses could be very deep.
Very often it conveys what we are really concerned for the
problems of human beings or the society, e.g. Kafka's work.
Reality has its cruel side, but also has its bright side.
From another point of view, we also need more lively
work to keep the balance. I recalled a paragraph in
Bai2 Xian1 Yong3's "Mu4 Ran2 Hui2 Shou3"(白先勇 "蓦然回首"),
as pasted below.
后来又在文学杂志上继续 |
|
d*****s 发帖数: 313 | 31 bu4 neng2 zai4 chui3 peng3 xia4 qu4 le. Bu4 ran2 wo3 gai1 shuo1 wo3
LD ye3 shuo1 ni3 pp le...:) |
|
h***s 发帖数: 2499 | 32 产生一个ran2()number 和读取文件一个double,哪个快?
一次run是一个温度,重复是要模拟时间演化
第二次run用一样的rdn应该没问题 |
|
k****f 发帖数: 3794 | 33 如果就是1个,肯定是ran2快
如果是很多个,读取double应该会不错的 |
|
b***f 发帖数: 39 | 34 用其他的库会好些, 比如 Numerical Recipe 中的 ran2() |
|
s***e 发帖数: 911 | 35
Numerical recipe里面的ran2.f能干这个,很不错的程序; |
|
s***e 发帖数: 911 | 36
首先计算机是无法产生不"伪"的随即数的. 这里的伪是指同样的初始值迭带
同样次数一定会得到同样的结果, 也就是一样的初始值值对应的迭代轨道相同.
但是这个"伪随即数"并不是指该随即数序列不够"随机". 实际上所有的随机数序列
都有一个特点, 都对初始值具有极端的敏感性. 实际两个不同的叠代轨道序列
统计上是无关的. 对给定的迭代序列进行统计分析, 也可以得到相当满意的统计
特征.
现在最常用的算法recipe上提供了子程序. 你需要的是一个uniform分布的随机
数, recipe里名字叫ran2. 你若需要fortran子程序,我可以寄给你. |
|
j******o 发帖数: 127 | 37 data c;
if _n_=1 then do;
set b (rename=(nu=nu1 ran=ran1) firstobs=1 obs=1);
set b (rename=(nu=nu2 ran=ran2) firstobs=2 obs=2);
end;
set a;
run; |
|