/* drfmod.c CCMATH mathematics library source code. * * Copyright (C) 2000 Daniel A. Atkinson All rights reserved. * This code may be redistributed under the terms of the GNU library * public license (LGPL). ( See the lgpl.license file for details.) * ------------------------------------------------------------------------ */ #include "armaf.h" #include extern struct mcof *pfc,*par,*pma; extern int nar,nma,nfc,np,ndif; static int kst,kd,max,mxm,*kz; static double *pm,*pz; double drfmod(struct fmod y,double *dr) { struct mcof *p,*q; double yp,*pf,*pd,*pl,sa; int j; yp=sa=(pfc+y.fac)->cf; for(j=0,pf=dr; jlag)%max)==j) *pf -= p->cf; } if(ndif){ pd=pz+2*max+np*mxm; pl=dr+nfc; for(pf=dr; pflag)%max); yp += p->cf * *pf++;} for(p=pma,q=p+nma; plag)%max); yp += p->cf * *pf++;} if(nma){ pl=dr+np; for(pf=dr,pd=pz+2*max; pfcf * *(pd+((kd+p->lag)%mxm)*np); kd=(kd+mxm-1)%mxm; pd=pz+2*max+np*kd; for(pf=dr; pflag+1; if(nma && (mxm=(pma+nma-1)->lag+1)>max) max=mxm; pz=(double *)calloc(2*max+np*mxm+ndif*(nfc+1),sizeof(double)); kz=(int *)calloc(max,sizeof(int)); pm=pz+max; } else{ free(pz); free(kz);} }