home *** CD-ROM | disk | FTP | other *** search
- crosco(a,b,n,l,bla,bda)
-
- /* finds the cross-covariances of series a with */
- /* series b. */
-
- int l,n;
- float a[],b[],bla[],bda[];
-
- {
- int i,j,ij,nj;
- float avea,aveb,aveab,fn,fnj,sr,ss;
-
- avea = 0.;
- aveb = 0.;
- fn = n;
- for(i = 0; i <= n-1; i++)
- {
- avea = avea + a[i]/fn;
- aveb = aveb + b[i]/fn;
- }
- aveab = avea * aveb;
-
- for(j = 1; j <= l; j++)
- {
- nj = n - j + 1;
- fnj = nj;
- fnj = 1./fnj;
- sr = 0.;
- ss = 0.;
-
- for(i = 1; i <= nj; i++)
- {
- ij = i + j - 1;
- sr = sr + (a[i-1] * b[ij-1] * fnj);
- ss = ss + (a[ij-1] * b[i-1] * fnj);
- }
- bla[j-1] = sr - aveab;
- bda[j-1] = ss - aveab;
- }
- }