#include #include "Malloc.h" #include "error.h" #include "qromo.h" #define NR_END 1 static float *vector(long nl, long nh) /* allocate a float vector with subscript range v[nl..nh] */ { float *v; v = Malloc((nh-nl+1+NR_END)*sizeof(float)); return v-nl+NR_END; } static void free_vector(v,nl,nh) float *v; long nh,nl; /* free a float vector allocated with vector() */ { Free(v+nl-NR_END); } void polint(float xa[], float ya[], int n, float x, float *y, float *dy) { int i,m,ns=1; float den,dif,dift,ho,hp,w; float *c,*d; dif=fabs(x-xa[1]); c=vector(1,n); d=vector(1,n); for (i=1;i<=n;i++) { if ( (dift=fabs(x-xa[i])) < dif) { ns=i; dif=dift; } c[i]=ya[i]; d[i]=ya[i]; } *y=ya[ns--]; for (m=1;m= K) { polint(&h[j-K],&s[j-K],K,0.0,&ss,&dss); if (fabs(dss) < EPS*fabs(ss)) return ss; } s[j+1]=s[j]; h[j+1]=h[j]/9.0; } Error("Too many steps in routing qromo"); return 0.0; }