没有matlab,用octave跑了跑,每个内循环大概花4秒多,用时比较稳定,没有越来越慢:
xy_2d=randn(8192,8192);
z_2d=randn(800,900);
u2 = ones(8192, 8192);
l_c = cputime();
for ite1 = 1:800
for ite2 = 1:900
u = exp(i.*sqrt(xy_2d- z_2d(ite1,ite2)));
u2 = u2.*u;
c_c = cputime ();
printf("%f\n", c_c - l_c);
l_c = c_c;
end
end
$ octave a.m
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
4.765148
4.862631
4.779450
5.041904
4.884259
4.147731
4.518169
4.276477
3.707727
4.330566
4.823088
4.806313
4.823238
4.885304
4.861114
4.953960
3.853307
4.220949
4.907371
3.995417
4.943422
4.870499
3.797168
4.689785
4.807867
【 在 novicer 的大作中提到: 】
: u2 = exp(i.*zeros(8192,8192));
: for ite1 = 1:800
: for ite2 = 1:900
: ...................
--
FROM 173.38.117.*