function crosscorr,A,B ; Computes the cross correlation of two real arrays A and B (same size) f=A-mean(A) g=B-mean(B) cc=fft(fft(f,1)*conj(fft(g,1)),-1) c1=total(f^2) c2=total(g^2) cc=cc/sqrt(c1*c2) return,cc end