diff -C1 -r 206b/recipes_c-kr/COPYRIGHT.NOTICE 208/recipes_c-kr/COPYRIGHT.NOTICE *** 206b/recipes_c-kr/COPYRIGHT.NOTICE Wed Feb 07 19:47:56 1996 --- 208/recipes_c-kr/COPYRIGHT.NOTICE Sun Jul 06 08:14:49 1997 *************** *** 1,2 **** The contents of this Numerical Recipes C distribution are ! Copyright (C) 1986-1996 Numerical Recipes Software. --- 1,2 ---- The contents of this Numerical Recipes C distribution are ! Copyright (C) 1986-1997 Numerical Recipes Software. diff -C1 -r 206b/recipes_c-kr/demo/answers/xcaldat.reslt 208/recipes_c-kr/demo/answers/xcaldat.reslt *** 206b/recipes_c-kr/demo/answers/xcaldat.reslt Mon Oct 19 08:13:31 1992 --- 208/recipes_c-kr/demo/answers/xcaldat.reslt Mon Jul 07 02:36:55 1997 *************** *** 5,7 **** january 1 1 1721424 january 1 1 ! october 14 1582 2299170 october 24 1582 october 15 1582 2299161 october 15 1582 --- 5,7 ---- january 1 1 1721424 january 1 1 ! october 4 1582 2299160 october 4 1582 october 15 1582 2299161 october 15 1582 diff -C1 -r 206b/recipes_c-kr/demo/answers/xjulday.reslt 208/recipes_c-kr/demo/answers/xjulday.reslt *** 206b/recipes_c-kr/demo/answers/xjulday.reslt Mon Oct 19 08:19:53 1992 --- 208/recipes_c-kr/demo/answers/xjulday.reslt Mon Jul 07 02:36:36 1997 *************** *** 4,6 **** january 1 1 1721424 One day later ! october 14 1582 2299170 Day before Gregorian calendar october 15 1582 2299161 Gregorian calendar adopted --- 4,6 ---- january 1 1 1721424 One day later ! october 4 1582 2299160 Day before Gregorian calendar october 15 1582 2299161 Gregorian calendar adopted diff -C1 -r 206b/recipes_c-kr/demo/bin/dates1.dat 208/recipes_c-kr/demo/bin/dates1.dat *** 206b/recipes_c-kr/demo/bin/dates1.dat Tue May 12 09:16:27 1992 --- 208/recipes_c-kr/demo/bin/dates1.dat Tue Jul 01 05:56:20 1997 *************** *** 4,6 **** 01 01 1 One day later ! 10 14 1582 Day before Gregorian calendar 10 15 1582 Gregorian calendar adopted --- 4,6 ---- 01 01 1 One day later ! 10 04 1582 Day before Gregorian calendar 10 15 1582 Gregorian calendar adopted diff -C1 -r 206b/recipes_c-kr/demo/data/dates1.dat 208/recipes_c-kr/demo/data/dates1.dat *** 206b/recipes_c-kr/demo/data/dates1.dat Tue May 12 09:16:27 1992 --- 208/recipes_c-kr/demo/data/dates1.dat Tue Jul 01 05:56:20 1997 *************** *** 4,6 **** 01 01 1 One day later ! 10 14 1582 Day before Gregorian calendar 10 15 1582 Gregorian calendar adopted --- 4,6 ---- 01 01 1 One day later ! 10 04 1582 Day before Gregorian calendar 10 15 1582 Gregorian calendar adopted diff -C1 -r 206b/recipes_c-kr/demo/results/dates1.dat 208/recipes_c-kr/demo/results/dates1.dat *** 206b/recipes_c-kr/demo/results/dates1.dat Tue May 12 09:16:27 1992 --- 208/recipes_c-kr/demo/results/dates1.dat Tue Jul 01 05:56:20 1997 *************** *** 4,6 **** 01 01 1 One day later ! 10 14 1582 Day before Gregorian calendar 10 15 1582 Gregorian calendar adopted --- 4,6 ---- 01 01 1 One day later ! 10 04 1582 Day before Gregorian calendar 10 15 1582 Gregorian calendar adopted diff -C1 -r 206b/recipes_c-kr/doc/COMPILING 208/recipes_c-kr/doc/COMPILING *** 206b/recipes_c-kr/doc/COMPILING Sat Feb 24 13:12:29 1996 --- 208/recipes_c-kr/doc/COMPILING Tue Jul 15 10:42:59 1997 *************** *** 146 **** --- 146,156 ---- + NeXT: + Use 'ranlib' instead of 'ar' in the master makefile. + In ANSI recipes/makefile, all /usr/include paths need to be + changed to /usr/include/ansi + One user reports: + - in the demo/bin/makefile, i had to simplify the OUTRULE a + little by taking out the '$?' in OUTRULE and adding another + var i called SRCPATH that points directly at where the .c + file is, and changed each rule so that : xxx.c became + : $(SRCPATH)xxx.c diff -C1 -r 206b/recipes_c-kr/doc/COPYRIGHT.NOTICE 208/recipes_c-kr/doc/COPYRIGHT.NOTICE *** 206b/recipes_c-kr/doc/COPYRIGHT.NOTICE Wed Feb 07 19:47:56 1996 --- 208/recipes_c-kr/doc/COPYRIGHT.NOTICE Sun Jul 06 08:14:49 1997 *************** *** 1,2 **** The contents of this Numerical Recipes C distribution are ! Copyright (C) 1986-1996 Numerical Recipes Software. --- 1,2 ---- The contents of this Numerical Recipes C distribution are ! Copyright (C) 1986-1997 Numerical Recipes Software. diff -C1 -r 206b/recipes_c-kr/doc/VERSION 208/recipes_c-kr/doc/VERSION *** 206b/recipes_c-kr/doc/VERSION Sun Apr 23 09:10:40 1995 --- 208/recipes_c-kr/doc/VERSION Sat Jul 19 09:26:11 1997 *************** *** 1,2 **** Numerical Recipes in C ! Unix Version 2.06 --- 1,2 ---- Numerical Recipes in C ! Unix Version 2.08 diff -C1 -r 206b/recipes_c-kr/misc/nr.h 208/recipes_c-kr/misc/nr.h *** 206b/recipes_c-kr/misc/nr.h Tue Nov 17 04:31:33 1992 --- 208/recipes_c-kr/misc/nr.h Sun Jul 06 09:15:45 1997 *************** *** 436,438 **** float *bmax); ! void simp2(float **a, int n, int l2[], int nl2, int *ip, int kp, float *q1); void simp3(float **a, int i1, int k1, int ip, int kp); --- 436,438 ---- float *bmax); ! void simp2(float **a, int m, int n, int *ip, int kp); void simp3(float **a, int i1, int k1, int ip, int kp); diff -C1 -r 206b/recipes_c-kr/recipes/amoeba.c 208/recipes_c-kr/recipes/amoeba.c *** 206b/recipes_c-kr/recipes/amoeba.c Mon Oct 12 03:22:49 1992 --- 208/recipes_c-kr/recipes/amoeba.c Mon Jul 14 20:34:06 1997 *************** *** 2,3 **** --- 2,4 ---- #include "nrutil.h" + #define TINY 1.0e-10 #define NMAX 5000 *************** *** 30,32 **** } ! rtol=2.0*fabs(y[ihi]-y[ilo])/(fabs(y[ihi])+fabs(y[ilo])); if (rtol < ftol) { --- 31,33 ---- } ! rtol=2.0*fabs(y[ihi]-y[ilo])/(fabs(y[ihi])+fabs(y[ilo])+TINY); if (rtol < ftol) { diff -C1 -r 206b/recipes_c-kr/recipes/arcode.c 208/recipes_c-kr/recipes/arcode.c *** 206b/recipes_c-kr/recipes/arcode.c Mon Oct 12 03:22:53 1992 --- 208/recipes_c-kr/recipes/arcode.c Mon Jul 14 20:34:06 1997 *************** *** 60,62 **** fprintf(stderr,"Attempting to expand its size.\n"); ! *lcode *= 1.5; if ((*codep=(unsigned char *)realloc(*codep, --- 60,62 ---- fprintf(stderr,"Attempting to expand its size.\n"); ! *lcode += *lcode/2; if ((*codep=(unsigned char *)realloc(*codep, diff -C1 -r 206b/recipes_c-kr/recipes/banbks.c 208/recipes_c-kr/recipes/banbks.c *** 206b/recipes_c-kr/recipes/banbks.c Mon Oct 12 03:22:56 1992 --- 208/recipes_c-kr/recipes/banbks.c Mon Jul 14 20:34:06 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define SWAP(a,b) {dum=(a);(a)=(b);(b)=dum;} diff -C1 -r 206b/recipes_c-kr/recipes/beschb.c 208/recipes_c-kr/recipes/beschb.c *** 206b/recipes_c-kr/recipes/beschb.c Sun Mar 19 18:00:33 1995 --- 208/recipes_c-kr/recipes/beschb.c Mon Jul 14 20:34:06 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define NUSE1 5 diff -C1 -r 206b/recipes_c-kr/recipes/brent.c 208/recipes_c-kr/recipes/brent.c *** 206b/recipes_c-kr/recipes/brent.c Sun Mar 19 18:00:33 1995 --- 208/recipes_c-kr/recipes/brent.c Mon Jul 14 20:34:07 1997 *************** *** 65,66 **** --- 65,68 ---- nrerror("Too many iterations in brent"); + *xmin=x; + return fx; } diff -C1 -r 206b/recipes_c-kr/recipes/caldat.c 208/recipes_c-kr/recipes/caldat.c *** 206b/recipes_c-kr/recipes/caldat.c Mon Oct 12 03:23:10 1992 --- 208/recipes_c-kr/recipes/caldat.c Mon Jul 14 20:34:07 1997 *************** *** 12,13 **** --- 12,15 ---- ja=julian+1+jalpha-(long) (0.25*jalpha); + } else if (julian < 0) { + ja=julian+36525*(1-julian/36525); } else *************** *** 24,25 **** --- 26,28 ---- if (*iyyy <= 0) --(*iyyy); + if (julian < 0) iyyy -= 100*(1-julian/36525); } diff -C1 -r 206b/recipes_c-kr/recipes/covsrt.c 208/recipes_c-kr/recipes/covsrt.c *** 206b/recipes_c-kr/recipes/covsrt.c Mon Oct 12 03:23:16 1992 --- 208/recipes_c-kr/recipes/covsrt.c Mon Jul 14 20:34:07 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define SWAP(a,b) {swap=(a);(a)=(b);(b)=swap;} diff -C1 -r 206b/recipes_c-kr/recipes/dfpmin.c 208/recipes_c-kr/recipes/dfpmin.c *** 206b/recipes_c-kr/recipes/dfpmin.c Mon Oct 12 03:23:21 1992 --- 208/recipes_c-kr/recipes/dfpmin.c Mon Jul 14 20:34:07 1997 *************** *** 77,79 **** } ! if (fac*fac > EPS*sumdg*sumxi) { fac=1.0/fac; --- 77,79 ---- } ! if (fac > sqrt(EPS*sumdg*sumxi)) { fac=1.0/fac; *************** *** 82,84 **** for (i=1;i<=n;i++) { ! for (j=1;j<=n;j++) { hessin[i][j] += fac*xi[i]*xi[j] --- 82,84 ---- for (i=1;i<=n;i++) { ! for (j=i;j<=n;j++) { hessin[i][j] += fac*xi[i]*xi[j] *************** *** 85,86 **** --- 85,87 ---- -fad*hdg[i]*hdg[j]+fae*dg[i]*dg[j]; + hessin[j][i]=hessin[i][j]; } diff -C1 -r 206b/recipes_c-kr/recipes/fit.c 208/recipes_c-kr/recipes/fit.c *** 206b/recipes_c-kr/recipes/fit.c Mon Oct 12 03:23:39 1992 --- 208/recipes_c-kr/recipes/fit.c Mon Jul 14 20:34:08 1997 *************** *** 46,47 **** --- 46,48 ---- *chi2=0.0; + *q=1.0; if (mwt == 0) { *************** *** 49,51 **** *chi2 += SQR(y[i]-(*a)-(*b)*x[i]); - *q=1.0; sigdat=sqrt((*chi2)/(ndata-2)); --- 50,51 ---- *************** *** 56,58 **** *chi2 += SQR((y[i]-(*a)-(*b)*x[i])/sig[i]); ! *q=gammq(0.5*(ndata-2),0.5*(*chi2)); } --- 56,58 ---- *chi2 += SQR((y[i]-(*a)-(*b)*x[i])/sig[i]); ! if (ndata>2) *q=gammq(0.5*(ndata-2),0.5*(*chi2)); } diff -C1 -r 206b/recipes_c-kr/recipes/frprmn.c 208/recipes_c-kr/recipes/frprmn.c *** 206b/recipes_c-kr/recipes/frprmn.c Mon Oct 12 03:23:49 1992 --- 208/recipes_c-kr/recipes/frprmn.c Mon Jul 14 20:34:09 1997 *************** *** 32,34 **** } ! fp=(*func)(p); (*dfunc)(p,xi); --- 32,34 ---- } ! fp= *fret; (*dfunc)(p,xi); diff -C1 -r 206b/recipes_c-kr/recipes/gasdev.c 208/recipes_c-kr/recipes/gasdev.c *** 206b/recipes_c-kr/recipes/gasdev.c Mon Oct 12 03:23:53 1992 --- 208/recipes_c-kr/recipes/gasdev.c Mon Jul 14 20:34:09 1997 *************** *** 10,11 **** --- 10,12 ---- + if (*idum < 0) iset=0; if (iset == 0) { diff -C1 -r 206b/recipes_c-kr/recipes/hpsort.c 208/recipes_c-kr/recipes/hpsort.c *** 206b/recipes_c-kr/recipes/hpsort.c Mon Oct 12 03:24:00 1992 --- 208/recipes_c-kr/recipes/hpsort.c Mon Jul 14 20:34:09 1997 *************** *** 29,31 **** j <<= 1; ! } else j=ir+1; } --- 29,31 ---- j <<= 1; ! } else break; } diff -C1 -r 206b/recipes_c-kr/recipes/hufmak.c 208/recipes_c-kr/recipes/hufmak.c *** 206b/recipes_c-kr/recipes/hufmak.c Mon Oct 12 03:24:03 1992 --- 208/recipes_c-kr/recipes/hufmak.c Mon Jul 14 20:34:09 1997 *************** *** 38,40 **** hcode->right[k]=index[1]; ! up[index[1]] = -k; up[node]=index[1]=k; --- 38,40 ---- hcode->right[k]=index[1]; ! up[index[1]] = -(long)k; up[node]=index[1]=k; diff -C1 -r 206b/recipes_c-kr/recipes/irbit1.c 208/recipes_c-kr/recipes/irbit1.c *** 206b/recipes_c-kr/recipes/irbit1.c Mon Oct 12 03:24:10 1992 --- 208/recipes_c-kr/recipes/irbit1.c Mon Jul 14 20:34:09 1997 *************** *** 1,6 **** - #define IB1 1 - #define IB2 2 - #define IB5 16 - #define IB18 131072 - int irbit1(iseed) --- 1 ---- *************** *** 10,15 **** ! newbit = (*iseed & IB18) >> 17 ! ^ (*iseed & IB5) >> 4 ! ^ (*iseed & IB2) >> 1 ! ^ (*iseed & IB1); *iseed=(*iseed << 1) | newbit; --- 5,10 ---- ! newbit = (*iseed >> 17) & 1 ! ^ (*iseed >> 4) & 1 ! ^ (*iseed >> 1) & 1 ! ^ (*iseed & 1); *iseed=(*iseed << 1) | newbit; *************** *** 17,21 **** } - #undef IB1 - #undef IB2 - #undef IB5 - #undef IB18 --- 12 ---- diff -C1 -r 206b/recipes_c-kr/recipes/irbit2.c 208/recipes_c-kr/recipes/irbit2.c *** 206b/recipes_c-kr/recipes/irbit2.c Mon Oct 12 03:24:11 1992 --- 208/recipes_c-kr/recipes/irbit2.c Mon Jul 14 20:34:09 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define IB1 1 diff -C1 -r 206b/recipes_c-kr/recipes/laguer.c 208/recipes_c-kr/recipes/laguer.c *** 206b/recipes_c-kr/recipes/laguer.c Mon Oct 12 03:24:16 1992 --- 208/recipes_c-kr/recipes/laguer.c Mon Jul 14 20:34:10 1997 *************** *** 41,43 **** dx=((FMAX(abp,abm) > 0.0 ? Cdiv(Complex((float) m,0.0),gp) ! : RCmul(exp(log(1+abx)),Complex(cos((float)iter),sin((float)iter))))); x1=Csub(*x,dx); --- 41,43 ---- dx=((FMAX(abp,abm) > 0.0 ? Cdiv(Complex((float) m,0.0),gp) ! : RCmul(1+abx,Complex(cos((float)iter),sin((float)iter))))); x1=Csub(*x,dx); diff -C1 -r 206b/recipes_c-kr/recipes/lnsrch.c 208/recipes_c-kr/recipes/lnsrch.c *** 206b/recipes_c-kr/recipes/lnsrch.c Mon Oct 12 03:24:20 1992 --- 208/recipes_c-kr/recipes/lnsrch.c Mon Jul 14 20:34:10 1997 *************** *** 10,12 **** int i; ! float a,alam,alam2,alamin,b,disc,f2,fold2,rhs1,rhs2,slope,sum,temp, test,tmplam; --- 10,12 ---- int i; ! float a,alam,alam2,alamin,b,disc,f2,rhs1,rhs2,slope,sum,temp, test,tmplam; *************** *** 20,21 **** --- 20,22 ---- slope += g[i]*p[i]; + if (slope >= 0.0) nrerror("Roundoff problem in lnsrch."); test=0.0; *************** *** 40,42 **** rhs1 = *f-fold-alam*slope; ! rhs2=f2-fold2-alam2*slope; a=(rhs1/(alam*alam)-rhs2/(alam2*alam2))/(alam-alam2); --- 41,43 ---- rhs1 = *f-fold-alam*slope; ! rhs2=f2-fold-alam2*slope; a=(rhs1/(alam*alam)-rhs2/(alam2*alam2))/(alam-alam2); *************** *** 46,51 **** disc=b*b-3.0*a*slope; ! if (disc<0.0) nrerror("Roundoff problem in lnsrch."); ! else tmplam=(-b+sqrt(disc))/(3.0*a); } ! if (tmplam>0.5*alam) tmplam=0.5*alam; --- 47,53 ---- disc=b*b-3.0*a*slope; ! if (disc < 0.0) tmplam=0.5*alam; ! else if (b <= 0.0) tmplam=(-b+sqrt(disc))/(3.0*a); ! else tmplam=-slope/(b+sqrt(disc)); } ! if (tmplam > 0.5*alam) tmplam=0.5*alam; *************** *** 55,57 **** f2 = *f; - fold2=fold; alam=FMAX(tmplam,0.1*alam); --- 57,58 ---- diff -C1 -r 206b/recipes_c-kr/recipes/midinf.c 208/recipes_c-kr/recipes/midinf.c *** 206b/recipes_c-kr/recipes/midinf.c Mon Oct 12 03:24:29 1992 --- 208/recipes_c-kr/recipes/midinf.c Mon Jul 14 20:34:10 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define FUNC(x) ((*funk)(1.0/(x))/((x)*(x))) diff -C1 -r 206b/recipes_c-kr/recipes/midpnt.c 208/recipes_c-kr/recipes/midpnt.c *** 206b/recipes_c-kr/recipes/midpnt.c Mon Oct 12 03:24:29 1992 --- 208/recipes_c-kr/recipes/midpnt.c Mon Jul 14 20:34:10 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define FUNC(x) ((*func)(x)) diff -C1 -r 206b/recipes_c-kr/recipes/mp2dfr.c 208/recipes_c-kr/recipes/mp2dfr.c *** 206b/recipes_c-kr/recipes/mp2dfr.c Mon Oct 12 03:24:33 1992 --- 208/recipes_c-kr/recipes/mp2dfr.c Mon Jul 14 20:34:12 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define IAZ 48 diff -C1 -r 206b/recipes_c-kr/recipes/mpdiv.c 208/recipes_c-kr/recipes/mpdiv.c *** 206b/recipes_c-kr/recipes/mpdiv.c Mon Oct 12 03:24:33 1992 --- 208/recipes_c-kr/recipes/mpdiv.c Mon Jul 14 20:34:12 1997 *************** *** 1,3 **** #include "nrutil.h" ! #define MACC 3 --- 1,3 ---- #include "nrutil.h" ! #define MACC 6 *************** *** 7,9 **** { ! void mpinv(),mpmov(),mpmul(),mpsub(); int is; --- 7,9 ---- { ! void mpinv(),mpmov(),mpmul(),mpsad(),mpsub(); int is; *************** *** 12,17 **** rr=cvector(1,(n+MACC)<<1); ! s=cvector(1,n+MACC); ! mpinv(s,v,n-m+MACC,m); ! mpmul(rr,s,u,n-m+MACC,n); ! mpmov(q,&rr[1],n-m+1); mpmul(rr,q,v,n-m+1,m); --- 12,18 ---- rr=cvector(1,(n+MACC)<<1); ! s=cvector(1,(n+MACC)<<1); ! mpinv(s,v,n+MACC,m); ! mpmul(rr,s,u,n+MACC,n); ! mpsad(s,rr,n+n+MACC/2,1); ! mpmov(q,&s[2],n-m+1); mpmul(rr,q,v,n-m+1,m); *************** *** 20,22 **** mpmov(r,&rr[n-m+1],m); ! free_cvector(s,1,n+MACC); free_cvector(rr,1,(n+MACC)<<1); --- 21,23 ---- mpmov(r,&rr[n-m+1],m); ! free_cvector(s,1,(n+MACC)<<1); free_cvector(rr,1,(n+MACC)<<1); diff -C1 -r 206b/recipes_c-kr/recipes/mpops.c 208/recipes_c-kr/recipes/mpops.c *** 206b/recipes_c-kr/recipes/mpops.c Mon Oct 12 03:24:35 1992 --- 208/recipes_c-kr/recipes/mpops.c Mon Jul 14 20:34:12 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define LOBYTE(x) ((unsigned char) ((x) & 0xff)) diff -C1 -r 206b/recipes_c-kr/recipes/mpsqrt.c 208/recipes_c-kr/recipes/mpsqrt.c *** 206b/recipes_c-kr/recipes/mpsqrt.c Mon Oct 12 03:24:38 1992 --- 208/recipes_c-kr/recipes/mpsqrt.c Mon Jul 14 20:34:12 1997 *************** *** 31,33 **** mplsh(r,n); ! mpmul(s,r,v,n,m); mplsh(s,n); --- 31,33 ---- mplsh(r,n); ! mpmul(s,r,v,n,IMIN(m,n)); mplsh(s,n); *************** *** 44,46 **** if (j del) { ! del=fabs(fptt-(*fret)); ibig=i; --- 26,29 ---- linmin(p,xit,n,fret,func); ! if (fptt-(*fret) > del) { ! del=fptt-(*fret); ibig=i; *************** *** 30,32 **** } ! if (2.0*fabs(fp-(*fret)) <= ftol*(fabs(fp)+fabs(*fret))) { free_vector(xit,1,n); --- 31,33 ---- } ! if (2.0*(fp-(*fret)) <= ftol*(fabs(fp)+fabs(*fret))+TINY) { free_vector(xit,1,n); diff -C1 -r 206b/recipes_c-kr/recipes/psdes.c 208/recipes_c-kr/recipes/psdes.c *** 206b/recipes_c-kr/recipes/psdes.c Mon Oct 12 03:24:49 1992 --- 208/recipes_c-kr/recipes/psdes.c Mon Jul 14 20:34:13 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define NITER 4 diff -C1 -r 206b/recipes_c-kr/recipes/qsimp.c 208/recipes_c-kr/recipes/qsimp.c *** 206b/recipes_c-kr/recipes/qsimp.c Wed Feb 02 09:01:06 1994 --- 208/recipes_c-kr/recipes/qsimp.c Mon Jul 14 20:34:13 1997 *************** *** 16,19 **** s=(4.0*st-ost)/3.0; ! if (fabs(s-os) < EPS*fabs(os)) return s; ! if (s == 0.0 && os == 0.0 && j > 6) return s; os=s; --- 16,20 ---- s=(4.0*st-ost)/3.0; ! if (j > 5) ! if (fabs(s-os) < EPS*fabs(os) || ! (s == 0.0 && os == 0.0)) return s; os=s; diff -C1 -r 206b/recipes_c-kr/recipes/qtrap.c 208/recipes_c-kr/recipes/qtrap.c *** 206b/recipes_c-kr/recipes/qtrap.c Wed Feb 02 09:01:07 1994 --- 208/recipes_c-kr/recipes/qtrap.c Mon Jul 14 20:34:13 1997 *************** *** 15,18 **** s=trapzd(func,a,b,j); ! if (fabs(s-olds) < EPS*fabs(olds)) return s; ! if (s == 0.0 && olds == 0.0 && j > 6) return s; olds=s; --- 15,19 ---- s=trapzd(func,a,b,j); ! if (j > 5) ! if (fabs(s-olds) < EPS*fabs(olds) || ! (s == 0.0 && olds == 0.0)) return s; olds=s; diff -C1 -r 206b/recipes_c-kr/recipes/ran0.c 208/recipes_c-kr/recipes/ran0.c *** 206b/recipes_c-kr/recipes/ran0.c Mon Oct 12 03:25:00 1992 --- 208/recipes_c-kr/recipes/ran0.c Mon Jul 14 20:34:13 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define IA 16807 diff -C1 -r 206b/recipes_c-kr/recipes/ran1.c 208/recipes_c-kr/recipes/ran1.c *** 206b/recipes_c-kr/recipes/ran1.c Mon Oct 12 03:25:01 1992 --- 208/recipes_c-kr/recipes/ran1.c Mon Jul 14 20:34:13 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define IA 16807 diff -C1 -r 206b/recipes_c-kr/recipes/ran2.c 208/recipes_c-kr/recipes/ran2.c *** 206b/recipes_c-kr/recipes/ran2.c Mon Oct 12 03:25:01 1992 --- 208/recipes_c-kr/recipes/ran2.c Mon Jul 14 20:34:13 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define IM1 2147483563 diff -C1 -r 206b/recipes_c-kr/recipes/ran3.c 208/recipes_c-kr/recipes/ran3.c *** 206b/recipes_c-kr/recipes/ran3.c Mon Oct 12 03:25:02 1992 --- 208/recipes_c-kr/recipes/ran3.c Mon Jul 14 20:34:13 1997 *************** *** 1 **** --- 1,2 ---- + #include #define MBIG 1000000000 *************** *** 16,18 **** iff=1; ! mj=MSEED-(*idum < 0 ? -*idum : *idum); mj %= MBIG; --- 17,19 ---- iff=1; ! mj=labs(MSEED-labs(*idum)); mj %= MBIG; diff -C1 -r 206b/recipes_c-kr/recipes/rtsafe.c 208/recipes_c-kr/recipes/rtsafe.c *** 206b/recipes_c-kr/recipes/rtsafe.c Mon Oct 12 03:25:21 1992 --- 208/recipes_c-kr/recipes/rtsafe.c Mon Jul 14 20:34:14 1997 *************** *** 30,32 **** for (j=1;j<=MAXIT;j++) { ! if ((((rts-xh)*df-f)*((rts-xl)*df-f) >= 0.0) || (fabs(2.0*f) > fabs(dxold*df))) { --- 30,32 ---- for (j=1;j<=MAXIT;j++) { ! if ((((rts-xh)*df-f)*((rts-xl)*df-f) > 0.0) || (fabs(2.0*f) > fabs(dxold*df))) { diff -C1 -r 206b/recipes_c-kr/recipes/savgol.c 208/recipes_c-kr/recipes/savgol.c *** 206b/recipes_c-kr/recipes/savgol.c Mon Oct 12 03:25:22 1992 --- 208/recipes_c-kr/recipes/savgol.c Mon Jul 14 20:34:14 1997 *************** *** 20,22 **** for (k=1;k<=nl;k++) sum += pow((double)-k,(double)ipj); ! mm=FMIN(ipj,2*m-ipj); for (imj = -mm;imj<=mm;imj+=2) a[1+(ipj+imj)/2][1+(ipj-imj)/2]=sum; --- 20,22 ---- for (k=1;k<=nl;k++) sum += pow((double)-k,(double)ipj); ! mm=IMIN(ipj,2*m-ipj); for (imj = -mm;imj<=mm;imj+=2) a[1+(ipj+imj)/2][1+(ipj-imj)/2]=sum; diff -C1 -r 206b/recipes_c-kr/recipes/select.c 208/recipes_c-kr/recipes/select.c *** 206b/recipes_c-kr/recipes/select.c Sun Mar 19 18:00:34 1995 --- 208/recipes_c-kr/recipes/select.c Mon Jul 14 20:34:14 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define SWAP(a,b) temp=(a);(a)=(b);(b)=temp; diff -C1 -r 206b/recipes_c-kr/recipes/simp1.c 208/recipes_c-kr/recipes/simp1.c *** 206b/recipes_c-kr/recipes/simp1.c Mon Oct 12 03:25:28 1992 --- 208/recipes_c-kr/recipes/simp1.c Mon Jul 14 20:34:14 1997 *************** *** 9,20 **** ! *kp=ll[1]; ! *bmax=a[mm+1][*kp+1]; ! for (k=2;k<=nll;k++) { ! if (iabf == 0) ! test=a[mm+1][ll[k]+1]-(*bmax); ! else ! test=fabs(a[mm+1][ll[k]+1])-fabs(*bmax); ! if (test > 0.0) { ! *bmax=a[mm+1][ll[k]+1]; ! *kp=ll[k]; } --- 9,24 ---- ! if (nll <= 0) ! *bmax=0.0; ! else { ! *kp=ll[1]; ! *bmax=a[mm+1][*kp+1]; ! for (k=2;k<=nll;k++) { ! if (iabf == 0) ! test=a[mm+1][ll[k]+1]-(*bmax); ! else ! test=fabs(a[mm+1][ll[k]+1])-fabs(*bmax); ! if (test > 0.0) { ! *bmax=a[mm+1][ll[k]+1]; ! *kp=ll[k]; ! } } diff -C1 -r 206b/recipes_c-kr/recipes/simp2.c 208/recipes_c-kr/recipes/simp2.c *** 206b/recipes_c-kr/recipes/simp2.c Sun Mar 19 18:00:34 1995 --- 208/recipes_c-kr/recipes/simp2.c Mon Jul 14 20:34:14 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define EPS 1.0e-6 *************** *** 2,9 **** ! void simp2(a,n,l2,nl2,ip,kp,q1) ! float **a,*q1; ! int *ip,kp,l2[],n,nl2; { ! int k,ii,i; ! float qp,q0,q; --- 3,10 ---- ! void simp2(a,m,n,ip,kp) ! float **a; ! int *ip,kp,m,n; { ! int k,i; ! float qp,q0,q,q1; *************** *** 10,24 **** *ip=0; ! for (i=1;i<=nl2;i++) ! if (a[l2[i]+1][kp+1] < -EPS) break; ! if (i>nl2) return; ! *q1 = -a[l2[i]+1][1]/a[l2[i]+1][kp+1]; ! *ip=l2[i]; ! for (i=i+1;i<=nl2;i++) { ! ii=l2[i]; ! if (a[ii+1][kp+1] < -EPS) { ! q = -a[ii+1][1]/a[ii+1][kp+1]; ! if (q < *q1) { ! *ip=ii; ! *q1=q; ! } else if (q == *q1) { for (k=1;k<=n;k++) { --- 11,24 ---- *ip=0; ! for (i=1;i<=m;i++) ! if (a[i+1][kp+1] < -EPS) break; ! if (i>m) return; ! q1 = -a[i+1][1]/a[i+1][kp+1]; ! *ip=i; ! for (i=*ip+1;i<=m;i++) { ! if (a[i+1][kp+1] < -EPS) { ! q = -a[i+1][1]/a[i+1][kp+1]; ! if (q < q1) { ! *ip=i; ! q1=q; ! } else if (q == q1) { for (k=1;k<=n;k++) { *************** *** 25,27 **** qp = -a[*ip+1][k+1]/a[*ip+1][kp+1]; ! q0 = -a[ii+1][k+1]/a[ii+1][kp+1]; if (q0 != qp) break; --- 25,27 ---- qp = -a[*ip+1][k+1]/a[*ip+1][kp+1]; ! q0 = -a[i+1][k+1]/a[i+1][kp+1]; if (q0 != qp) break; *************** *** 28,30 **** } ! if (q0 < qp) *ip=ii; } --- 28,30 ---- } ! if (q0 < qp) *ip=i; } diff -C1 -r 206b/recipes_c-kr/recipes/simplx.c 208/recipes_c-kr/recipes/simplx.c *** 206b/recipes_c-kr/recipes/simplx.c Sun Mar 19 18:00:34 1995 --- 208/recipes_c-kr/recipes/simplx.c Mon Jul 14 20:34:14 1997 *************** *** 2,5 **** #define EPS 1.0e-6 ! #define FREEALL free_ivector(l3,1,m);free_ivector(l2,1,m);\ ! free_ivector(l1,1,n+1); --- 2,4 ---- #define EPS 1.0e-6 ! #define FREEALL free_ivector(l3,1,m);free_ivector(l1,1,n+1); *************** *** 10,13 **** void simp1(),simp2(),simp3(); ! int i,ip,ir,is,k,kh,kp,m12,nl1,nl2; ! int *l1,*l2,*l3; float q1,bmax; --- 9,12 ---- void simp1(),simp2(),simp3(); ! int i,ip,is,k,kh,kp,nl1; ! int *l1,*l3; float q1,bmax; *************** *** 16,18 **** l1=ivector(1,n+1); - l2=ivector(1,m); l3=ivector(1,m); --- 15,16 ---- *************** *** 20,22 **** for (k=1;k<=n;k++) l1[k]=izrov[k]=k; - nl2=m; for (i=1;i<=m;i++) { --- 18,19 ---- *************** *** 23,25 **** if (a[i+1][1] < 0.0) nrerror("Bad input tableau in simplx"); - l2[i]=i; iposv[i]=n+i; --- 20,21 ---- *************** *** 26,31 **** } - for (i=1;i<=m2;i++) l3[i]=1; - ir=0; if (m2+m3) { ! ir=1; for (k=1;k<=(n+1);k++) { --- 22,25 ---- } if (m2+m3) { ! for (i=1;i<=m2;i++) l3[i]=1; for (k=1;k<=(n+1);k++) { *************** *** 35,37 **** } ! do { simp1(a,m+1,l1,nl1,0,&kp,&bmax); --- 29,31 ---- } ! for (;;) { simp1(a,m+1,l1,nl1,0,&kp,&bmax); *************** *** 41,44 **** } else if (bmax <= EPS && a[m+2][1] <= EPS) { ! m12=m1+m2+1; ! for (ip=m12;ip<=m;ip++) { if (iposv[ip] == (ip+n)) { --- 35,37 ---- } else if (bmax <= EPS && a[m+2][1] <= EPS) { ! for (ip=m1+m2+1;ip<=m;ip++) { if (iposv[ip] == (ip+n)) { *************** *** 45,47 **** simp1(a,ip,l1,nl1,1,&kp,&bmax); ! if (bmax > 0.0) goto one; --- 38,40 ---- simp1(a,ip,l1,nl1,1,&kp,&bmax); ! if (bmax > EPS) goto one; *************** *** 49,53 **** } ! ir=0; ! --m12; ! for (i=m1+1;i<=m12;i++) if (l3[i-m1] == 1) --- 42,44 ---- } ! for (i=m1+1;i<=m1+m2;i++) if (l3[i-m1] == 1) *************** *** 57,59 **** } ! simp2(a,n,l2,nl2,&ip,kp,&q1); if (ip == 0) { --- 48,50 ---- } ! simp2(a,m,n,&ip,kp); if (ip == 0) { *************** *** 68,80 **** for (is=k;is<=nl1;is++) l1[is]=l1[is+1]; - ++a[m+2][kp+1]; - for (i=1;i<=m+2;i++) a[i][kp+1] = -a[i][kp+1]; } else { ! if (iposv[ip] >= (n+m1+1)) { ! kh=iposv[ip]-m1-n; ! if (l3[kh]) { ! l3[kh]=0; ! ++a[m+2][kp+1]; ! for (i=1;i<=m+2;i++) ! a[i][kp+1] = -a[i][kp+1]; ! } } --- 59,67 ---- for (is=k;is<=nl1;is++) l1[is]=l1[is+1]; } else { ! kh=iposv[ip]-m1-n; ! if (kh >= 1 && l3[kh]) { ! l3[kh]=0; ! ++a[m+2][kp+1]; ! for (i=1;i<=m+2;i++) ! a[i][kp+1] = -a[i][kp+1]; } *************** *** 84,86 **** iposv[ip]=is; ! } while (ir); } --- 71,73 ---- iposv[ip]=is; ! } } *************** *** 88,90 **** simp1(a,0,l1,nl1,0,&kp,&bmax); ! if (bmax <= 0.0) { *icase=0; --- 75,77 ---- simp1(a,0,l1,nl1,0,&kp,&bmax); ! if (bmax <= EPS) { *icase=0; *************** *** 92,94 **** } ! simp2(a,n,l2,nl2,&ip,kp,&q1); if (ip == 0) { --- 79,81 ---- } ! simp2(a,m,n,&ip,kp); if (ip == 0) { diff -C1 -r 206b/recipes_c-kr/recipes/sort.c 208/recipes_c-kr/recipes/sort.c *** 206b/recipes_c-kr/recipes/sort.c Sun Mar 19 18:00:34 1995 --- 208/recipes_c-kr/recipes/sort.c Mon Jul 14 20:34:14 1997 *************** *** 9,12 **** { ! unsigned long i,ir=n,j,k,l=1; ! int jstack=0,*istack; float a,temp; --- 9,12 ---- { ! unsigned long i,ir=n,j,k,l=1,*istack; ! int jstack=0; float a,temp; *************** *** 13,15 **** ! istack=ivector(1,NSTACK); for (;;) { --- 13,15 ---- ! istack=lvector(1,NSTACK); for (;;) { *************** *** 63,65 **** } ! free_ivector(istack,1,NSTACK); } --- 63,65 ---- } ! free_lvector(istack,1,NSTACK); } diff -C1 -r 206b/recipes_c-kr/recipes/sort2.c 208/recipes_c-kr/recipes/sort2.c *** 206b/recipes_c-kr/recipes/sort2.c Sun Mar 19 18:00:34 1995 --- 208/recipes_c-kr/recipes/sort2.c Mon Jul 14 20:34:14 1997 *************** *** 9,12 **** { ! unsigned long i,ir=n,j,k,l=1; ! int *istack,jstack=0; float a,b,temp; --- 9,12 ---- { ! unsigned long i,ir=n,j,k,l=1,*istack; ! int jstack=0; float a,b,temp; *************** *** 13,15 **** ! istack=ivector(1,NSTACK); for (;;) { --- 13,15 ---- ! istack=lvector(1,NSTACK); for (;;) { *************** *** 28,30 **** if (!jstack) { ! free_ivector(istack,1,NSTACK); return; --- 28,30 ---- if (!jstack) { ! free_lvector(istack,1,NSTACK); return; diff -C1 -r 206b/recipes_c-kr/recipes/spread.c 208/recipes_c-kr/recipes/spread.c *** 206b/recipes_c-kr/recipes/spread.c Mon Oct 12 03:25:44 1992 --- 208/recipes_c-kr/recipes/spread.c Mon Jul 14 20:34:15 1997 *************** *** 8,10 **** int ihi,ilo,ix,j,nden; ! static int nfac[11]={0,1,1,2,6,24,120,720,5040,40320,362880}; float fac; --- 8,10 ---- int ihi,ilo,ix,j,nden; ! static long nfac[11]={0,1,1,2,6,24,120,720,5040,40320,362880}; float fac; diff -C1 -r 206b/recipes_c-kr/recipes/trapzd.c 208/recipes_c-kr/recipes/trapzd.c *** 206b/recipes_c-kr/recipes/trapzd.c Mon Oct 12 03:25:54 1992 --- 208/recipes_c-kr/recipes/trapzd.c Mon Jul 14 20:34:15 1997 *************** *** 1 **** --- 1,2 ---- + /* note #undef's at end of file */ #define FUNC(x) ((*func)(x))