#include #include #include #include #define N 500 float a[N][N],b[N][N],c[N][N]; float cc[N][N]; main() { int i,j,k; float seed,t1,t2,bjk,error,fnm2,ggl(float*); fnm2 = 1.0/((float)N); fnm2 = fnm2*fnm2; seed = 331.0; /* seed for ggl */ for(j=0;j float ggl(float *ds) { /* generate u(0,1) distributed random numbers. Seed ds must be saved between calls. ggl is essentially the same as the IMSL routine RNUM. W. Petersen and M. Troyer, 24 Oct. 2002, ETHZ: a modification of a fortran version from I. Vattulainen, Tampere Univ. of Technology, Finland, 1992 */ double t,d2=0.2147483647e10; t = (float) *ds; t = fmod(0.16807e5*t,d2); *ds = (float) t; return((float) ((t-1.0e0)/(d2-1.0e0))); }