Next: Function: avg_inv_spec() Up: GRASP Routines: Gravitational Radiation Previous: Comparison of signal detectability   Contents

## Function: correlate()

0 void correlate(float *s,float *h,float *c,float *r,int n)
This function evaluates the correlation (as a function of lag time ) defined by the discrete equivalent of equation ():
 (6.16.95)

It is assumed that and are Fourier transforms of real functions, and that is real. The factor of appears in () for efficiency reasons; in order to calculate the integral () one should set . The routine assumes that vanishes at both DC and the Nyquist frequency.

The arguments are:

s: Output. Upon return, the array s[0..n-1] contains the correlation at times

h: Input. The array h[0..n-1] contains the positive frequency () part of the complex function . The packing of into this array follows the scheme used by the Numerical Recipes routine realft(), which is described between equations (12.3.5) and (12.3.6) of [1]. The DC component is real, and located in h[0]. The Nyquist-frequency component is also real, and is located in h[1]. The array elements h[2] and h[3] contain the real and imaginary parts, respectively, of where . Array elements h[2j] and h[2j+1] contain the real and imaginary parts of for . It is assumed that is the Fourier transform of a real function, so that correlate() can infer the negative frequency components from the equation
c: Input. The array c[0..n-1] contains the complex function , packed in the same format as , with the same assumption that . Note that while you provide the function to the routine, it is the complex-conjugate of the function contained in the array c[ ] which is used in calculating the correlation. Thus if is positive, correlate(s,c,c,r,n) will always return .
r: Input. The array r[0..n/2] contains the values of the real function used as a weight in the integral. This is often chosen to be (twice!) the inverse of the receiver noise, as in equation (), so that . The array elements are arranged in order of increasing frequency, from the DC value at subscript 0, to the Nyquist frequency at subscript n/2. Thus, the 'th array element r[j] contains the real value , for . Again it is assumed that .
n: Input. The total length of the complex arrays h and c, and the number of points in the output array s. Note that the array r contains points. n must be even.
The correlation function calculated by this routine is and has the same dimensions as the product . The definition is
 (6.16.96)

where it is understood that and that , and that .

Note that the input arrays h[ ] and c[ ] can be the same array. For example correlate(s,c,c,r,n) calculates the discrete equivalent of

 (6.16.97)

Author: Bruce Allen, ballen@dirac.phys.uwm.edu
Comments: For the sake of efficiency, this function does not include the contribution from either DC or Nyquist frequency bins to the correlation (these are negligible in any sensible data).

Next: Function: avg_inv_spec() Up: GRASP Routines: Gravitational Radiation Previous: Comparison of signal detectability   Contents
Bruce Allen 2000-11-19