function out = inner_product(a, b, Sh)
% function out = inner_product(a, b, Sh)
% E Thrane: caculate matched filter inner product as defined in Eq. 2.4 of
% "Matched filtering of gravitational waves from inspiraling compact binaries:
% Computational cost and template placement" by Owen and Sathyaprakash
% a = fft of strain data
% b = fft of template
% Sh = noise power spectrum
% -------------------------
% If the user supplies arrays of ffts and power spectra, then the dimensions
% should be size(sf) = NTrials x NFreqBins so that size(out) = NTrials x 1

out = sum( (conj(a).*b)./Sh , 2);

return

