#include #include #define GETEXP(a,b) var.d = 2*a; var.i >>= 23; b = 127-(var.i & 127) #define MAX(a,b) ((a)>=(b)) ? (a) : (b) #define MM(m,i) mm[i+m*128] /* globals */ union Var_ { float d; int i; }; union Var_ var; /*================================================================= Computes the correlation dimension, after P. Grassberger. *================================================================*/ void correl(x, kmax, eps, logimax, membed, mindel, mm) float *x; float eps; int kmax, membed, mindel, logimax; int *mm; { int box[256][256]; int llist[100000]; int imax1, m, i, j, k; int i1, j1, i2, j2, l1, l2; int kp, kpn, logdx; float epsinv, x1, x2; float dx,ddx, dx2; imax1 = 1; imax1 <<= logimax; imax1 -= 1; epsinv=(float) 1./eps; for (m=0;m<=membed;m++) for(i=0;i<128;i++) MM(m,i)=0; for(i=0;i0)&&(kp<(k-mindel))) { dx=fabs(x1-x[kp-1]); if(dx0) { kp=kpn; kpn=llist[kp]; } llist[kp]=k; } x1=x2 ; i1=i2; } for(m=2;m<=membed;m++) for(i=126;i>=0;i--) { MM(m,i)+=MM(m,i+1); /* fprintf(stderr,"%d\t%d\t%d\n",m,i,MM(m,i)); */ } }