20#include <lal/Window.h>
21#include <lal/VectorOps.h>
22#include <lal/SinCosLUT.h>
44 memset( template->templatedata->data, 0,
sizeof(
REAL4 )*length );
45 memset( template->pixellocations->data, 0,
sizeof(
INT4 )*length );
48 template->period = 0.0;
49 template->moddepth = 0.0;
63 INT4 length = (
INT4 )template->templatedata->length;
64 memset( template->templatedata->data, 0,
sizeof(
REAL4 )*length );
65 memset( template->pixellocations->data, 0,
sizeof(
INT4 )*length );
68 template->period = 0.0;
69 template->moddepth = 0.0;
101 if (
vector->length > 0 ) {
156TwoSpectTemplateVector *
generateTwoSpectTemplateVector(
const REAL8 Pmin,
const REAL8 Pmax,
const REAL8 dfmin,
const REAL8 dfmax,
const REAL8 Tsft,
const REAL8 SFToverlap,
const REAL8 Tobs,
const UINT4 maxvectorlength,
const UINT4 minTemplateLength,
const UINT4 maxTemplateLength,
const UINT4 vectormathflag,
const BOOLEAN exactflag )
162 vector->SFToverlap = SFToverlap;
165 UINT4 numdfvals = (
UINT4 )( floor( 2.0 *
Tsft * ( dfmax - dfmin ) ) ) + 1, numtemplatesgenerated = 0;
166 REAL8 alpha0 = 45.0 * (
Tsft / 1800.0 ) + 30.0;
168 UINT4 numffts = (
UINT4 )floor( Tobs / (
Tsft - SFToverlap ) - 1 );
169 REAL4FFTPlan *plan = NULL;
174 for (
UINT4 ii = 0; ii < numdfvals; ii++ ) {
175 dfvals->
data[ii] = dfmin + 0.5 * ii /
Tsft;
177 for (
UINT4 ii = 0; ii < numdfvals; ii++ ) {
179 while ( P >= Pmin && P >= 2.0 * dfvals->
data[ii]*
Tsft *
Tsft && numtemplatesgenerated < vector->length ) {
183 XLAL_CHECK_NULL(
makeTemplate2(
vector->data[numtemplatesgenerated], 0.0, P, dfvals->
data[ii],
Tsft, SFToverlap, Tobs, minTemplateLength, vectormathflag, plan ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
185 numtemplatesgenerated++;
186 if ( numtemplatesgenerated ==
vector->length ) {
193 XLAL_CHECK_NULL(
makeTemplate2(
vector->data[numtemplatesgenerated], 0.5, P, dfvals->
data[ii],
Tsft, SFToverlap, Tobs, minTemplateLength, vectormathflag, plan ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
195 numtemplatesgenerated++;
196 if ( numtemplatesgenerated ==
vector->length ) {
200 REAL8 dP = P * P / ( alpha0 * Tobs * sqrt( dfvals->
data[ii] ) ) * ( 1 + P / ( alpha0 * Tobs ) );
203 if ( numtemplatesgenerated ==
vector->length ) {
211 fprintf( stderr,
"Templates generated = %d\n", numtemplatesgenerated );
255 UINT4 vectorlength, templatelength;
265 for (
UINT4 ii = 0; ii < vectorlength; ii++ ) {
295 INT4 roundedbinval = (
INT4 )round( freqbin );
296 REAL8 offset = freqbin - roundedbinval;
299 INT4 sigbin0 = roundedbinval - ffdatabin0;
302 UINT4 numfprbins = (
UINT4 )floorf( 0.5 * numffts ) + 1;
306 for (
UINT4 ii = 0; ii <
output->pixellocations->length; ii++ ) {
307 output->pixellocations->data[ii] += sigbin0 * numfprbins;
337 UINT4 numfprbins = (
UINT4 )floorf( 0.5 * numffts ) + 1;
346 INT4 roundedbinval = (
INT4 )round( freqbin );
348 INT4 sigbin0 = roundedbinval - ffdatabin0;
349 for (
UINT4 ii = 0; ii <
output->pixellocations->length; ii++ ) {
350 output->pixellocations->data[ii] += sigbin0 * numfprbins;
378 XLAL_CHECK( offset <= 0.5 && offset >= -0.5 && P != 0.0 && deltaf != 0.0,
XLAL_EINVAL,
"Invalid input (%f, %f, %f)\n", offset, P, deltaf );
380 UINT4 numffts = (
UINT4 )floor( Tobs / (
Tsft - SFToverlap ) - 1 );
381 UINT4 numfprbins = (
UINT4 )floorf( 0.5 * numffts ) + 1;
386 output->moddepth = deltaf;
389 memset(
output->templatedata->data, 0,
sizeof(
REAL4 )*
output->templatedata->length );
392 REAL8 periodf = 1.0 / P;
398 fpr->
data[ii] = (
REAL4 )ii * ( 1.0 / Tobs );
411 if (
N * P * omegapr->
data[omegapr->
length - 1] < 2.147483647e9 ) {
413 REAL4 tempSinValue = 0.0, cos_omegapr_times_period = 0.0, cos_N_times_omegapr_times_period = 0.0;
416 if ( cos_N_times_omegapr_times_period > 1.0 ) {
417 cos_N_times_omegapr_times_period = 1.0;
419 if ( cos_omegapr_times_period > 1.0 ) {
420 cos_omegapr_times_period = 1.0;
422 if ( cos_N_times_omegapr_times_period < -1.0 ) {
423 cos_N_times_omegapr_times_period = -1.0;
425 if ( cos_omegapr_times_period < -1.0 ) {
426 cos_omegapr_times_period = -1.0;
428 if ( cos_N_times_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) && cos_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
429 cos_ratio->data[ii] = ( 1.0 - cos_N_times_omegapr_times_period ) / ( 1.0 - cos_omegapr_times_period );
430 }
else if ( cos_N_times_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
432 cos_ratio->data[ii] = 2.0 * ( 1.0 - cos_N_times_omegapr_times_period ) / ( fmodval * fmodval );
433 }
else if ( cos_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
435 cos_ratio->data[ii] = 0.5 * fmodval * fmodval / ( 1.0 - cos_omegapr_times_period );
437 cos_ratio->data[ii] = (
REAL4 )(
N *
N );
440 }
else if ( P * omegapr->
data[omegapr->
length - 1] < 2.147483647e9 ) {
442 REAL4 tempSinValue = 0.0, cos_omegapr_times_period = 0.0;
444 if ( cos_omegapr_times_period > 1.0 ) {
445 cos_omegapr_times_period = 1.0;
447 if ( cos_omegapr_times_period < -1.0 ) {
448 cos_omegapr_times_period = -1.0;
450 REAL4 cos_N_times_omegapr_times_period = cosf( (
REAL4 )(
N * P * omegapr->
data[ii] ) );
451 if ( cos_N_times_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) && cos_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
452 cos_ratio->data[ii] = ( 1.0 - cos_N_times_omegapr_times_period ) / ( 1.0 - cos_omegapr_times_period );
453 }
else if ( cos_N_times_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
455 cos_ratio->data[ii] = 2.0 * ( 1.0 - cos_N_times_omegapr_times_period ) / ( fmodval * fmodval );
456 }
else if ( cos_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
458 cos_ratio->data[ii] = 0.5 * fmodval * fmodval / ( 1.0 - cos_omegapr_times_period );
460 cos_ratio->data[ii] = (
REAL4 )(
N *
N );
465 REAL4 cos_omegapr_times_period = cosf( (
REAL4 )( P * omegapr->
data[ii] ) );
466 REAL4 cos_N_times_omegapr_times_period = cosf( (
REAL4 )(
N * P * omegapr->
data[ii] ) );
467 if ( cos_N_times_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) && cos_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
468 cos_ratio->data[ii] = ( 1.0 - cos_N_times_omegapr_times_period ) / ( 1.0 - cos_omegapr_times_period );
469 }
else if ( cos_N_times_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
471 cos_ratio->data[ii] = 2.0 * ( 1.0 - cos_N_times_omegapr_times_period ) / ( fmodval * fmodval );
472 }
else if ( cos_omegapr_times_period <= ( 1.0 - 100.0 *
LAL_REAL4_EPS ) ) {
474 cos_ratio->data[ii] = 0.5 * fmodval * fmodval / ( 1.0 - cos_omegapr_times_period );
476 cos_ratio->data[ii] = (
REAL4 )(
N *
N );
483 REAL8 binmin = -binamplitude + offset;
484 REAL8 binmax = binamplitude + offset;
485 INT4 templatemin = (
INT4 )round( binmin ), templatemax = (
INT4 )round( binmax );
486 if ( templatemin > binmin ) {
489 if ( templatemin - binmin >= -0.5 ) {
492 if ( templatemax < binmax ) {
495 if ( templatemax - binmax <= 0.5 ) {
498 UINT4 templatespan = (
UINT4 )( templatemax - templatemin ) + 1;
499 REAL8 disttominbin = binmin - templatemin, disttomaxbin = templatemax - binmax, disttomidbin = offset - templatemin;
505 memset(
scale->data, 0, templatespan *
sizeof(
REAL4 ) );
506 memset( phi_actual->data, 0, templatespan *
sizeof(
REAL4 ) );
507 for (
UINT4 ii = 0; ii <
scale->length; ii++ ) {
508 if ( ii != 0 && ii !=
scale->length - 1 ) {
509 scale->data[ii] = 1.0;
510 }
else if ( ii == 0 ) {
518 if ( fabs( ii - disttomidbin ) / ( deltaf *
Tsft ) <= 1.0 ) {
519 phi_actual->data[ii] = 0.5 * P - asin( fabs( ii - disttomidbin ) / ( deltaf *
Tsft ) ) *
LAL_1_PI * P;
525 REAL4VectorAligned *sigmas = NULL, *wvals = NULL, *binvals = NULL, *bindiffvals = NULL, *absbindiffvals = NULL;
532 for (
UINT4 jj = 0; jj < binvals->length; jj++ ) {
533 binvals->data[jj] = -( (
REAL4 )jj + templatemin );
539 REAL4 sin2pix = 0.0, cos2pix = 0.0;
540 for (
UINT4 ii = 0; ii < wvals->length; ii++ ) {
543 if ( cos2pix > 1.0 ) {
545 }
else if ( cos2pix < -1.0 ) {
548 REAL4 sigbin = ( deltaf * cos2pix ) *
Tsft + offset;
556 if ( sigbinvelocity < 1.0e-4 ) {
557 sigbinvelocity = 1.0e-4;
561 REAL4 sigma = 0.5 *
Tsft * ( 0.5979 / ( sigbinvelocity - 3.2895e-5 ) );
564 memset( weightvals->data[ii]->data, 0,
sizeof(
REAL4 )*weightvals->data[ii]->length );
566 REAL4 threshold = 1.75;
568 if ( absbindiffvals->data[jj] < threshold ) {
577 REAL8 wavesigma = 0.0;
579 for (
UINT4 jj = 0; jj < wvals->length; jj++ ) {
580 if ( weightvals->data[jj]->data[ii] != 0.0 ) {
581 wavesigma += allsigmas->
data[jj]->
data[ii];
582 totalw += weightvals->data[jj]->data[ii];
585 sigmas->
data[ii] = (
REAL4 )( wavesigma / totalw );
589 REAL4VectorAligned *exp_neg_sigma_sq_times_omega_pr_sq = NULL, *sin_phi_times_omega_pr = NULL, *cos_phi_times_omega_pr = NULL, *phi_times_fpr = NULL, *datavector = NULL;
598 REAL4 log4pi = 2.53102424697f;
600 INT4 bins2middlebin = ii + templatemin;
602 memset( datavector->data, 0,
sizeof(
REAL4 )*datavector->length );
605 REAL4 scale1 = sqrtf( (
REAL4 )( 1.0 / ( 1.0 + expf( (
REAL4 )( -phi_actual->data[ii] * phi_actual->data[ii] * 0.5 / ( sigmas->
data[ii] * sigmas->
data[ii] ) ) ) ) ) );
610 REAL4 prefact0 = log4pi + 2.0 * logf( (
REAL4 )( scale1 * sigmas->
data[ii] ) );
612 if ( vectormathflag == 1 || vectormathflag == 2 ) {
616 UINT4 truncationLength = 1;
617 while ( truncationLength < omegapr_squared->length && exp_neg_sigma_sq_times_omega_pr_sq->
data[truncationLength] > -88.0 ) {
627 if ( phi_times_fpr->data[maxindex] <= 2.147483647e9 ) {
632 for (
UINT4 jj = 0; jj < truncationLength; jj++ ) {
633 cos_phi_times_omega_pr->data[jj] = cosf( (
REAL4 )
LAL_TWOPI * phi_times_fpr->data[jj] );
645 for (
UINT4 jj = 0; jj < omegapr_squared->length; jj++ ) {
647 if ( ( prefact0 - sigmas->
data[ii]*sigmas->
data[ii]*omegapr_squared->data[jj] ) > -88.0 ) {
648 exp_neg_sigma_sq_times_omega_pr_sq->
data[jj] = expf( (
REAL4 )( prefact0 - sigmas->
data[ii] * sigmas->
data[ii] * omegapr_squared->data[jj] ) );
650 if ( cos2pix > 1.0 ) {
652 }
else if ( cos2pix < -1.0 ) {
655 cos_phi_times_omega_pr->data[jj] = (
REAL4 )cos2pix;
656 datavector->data[jj] =
scale->data[ii] * exp_neg_sigma_sq_times_omega_pr_sq->
data[jj] * ( cos_phi_times_omega_pr->data[jj] + 1.0 ) * cos_ratio->data[jj];
665 sum += (
REAL8 )( datavector->data[jj] );
668 if ( datavector->data[jj] >
output->templatedata->data[
output->templatedata->length - 1] ) {
680 for (
UINT4 ii = 0; ii < minTemplateLength; ii++ ) {
683 UINT4 counter = minTemplateLength;
684 while ( counter < output->templatedata->length &&
output->templatedata->data[counter] >=
epsval_float( (
REAL4 )sum ) ) {
685 sum += (
REAL8 )
output->templatedata->data[counter];
688 for ( ; counter <
output->templatedata->length; counter++ ) {
689 output->templatedata->data[counter] = 0.0;
733 INT4 roundedbinval = (
INT4 )round( freqbin );
734 REAL8 offset = freqbin - roundedbinval;
737 INT4 sigbin0 = roundedbinval - ffdatabin0;
740 UINT4 numfprbins = (
UINT4 )floorf( 0.5 * numffts ) + 1;
742 XLAL_CHECK(
makeTemplate2(
output, offset, input.
period, input.
moddepth,
params->Tsft,
params->SFToverlap,
params->Tobs,
params->minTemplateLength, (
UINT4 )
params->vectorMath, plan ) ==
XLAL_SUCCESS,
XLAL_EFUNC );
744 for (
UINT4 ii = 0; ii <
output->pixellocations->length; ii++ ) {
745 output->pixellocations->data[ii] += sigbin0 * numfprbins;
777 output->moddepth = deltaf;
780 memset(
output->templatedata->data, 0,
sizeof(
REAL4 )*
output->templatedata->length );
782 UINT4 numffts = (
UINT4 )floor( Tobs / (
Tsft - SFToverlap ) - 1 );
783 UINT4 numfprbins = (
UINT4 )floorf( 0.5 * numffts ) + 1;
787 REAL8 binmin = -binamplitude + offset;
788 REAL8 binmax = binamplitude + offset;
789 INT4 templatemin = (
INT4 )round( binmin ), templatemax = (
INT4 )round( binmax );
790 if ( templatemin > binmin ) {
793 if ( templatemin - binmin >= -0.5 ) {
796 if ( templatemax < binmax ) {
799 if ( templatemax - binmax <= 0.5 ) {
802 UINT4 templatespan = (
UINT4 )( templatemax - templatemin ) + 1;
804 REAL8 periodf = 1.0 / P;
814 for (
UINT4 ii = 0; ii < templatespan; ii++ ) {
820 REAL8 PSDprefact = 2.0 / 3.0;
825 for (
UINT4 ii = 0; ii < numffts; ii++ ) {
826 t->data[ii] = 0.5 *
Tsft * ( ii + 1 );
834 for (
UINT4 ii = 0; ii < numffts; ii++ ) {
835 REAL8 sigbin = sigbin_sin2PiPeriodfT->data[ii];
837 for (
UINT4 jj = 0; jj < templatespan; jj++ ) {
840 if ( fabs( bindiffs->data[jj] ) <= 1.75 ) {
855 memcpy( windowdata->data,
win->data->data,
x->length *
sizeof(
REAL4 ) );
856 REAL8 winFactor = 8.0 / 3.0, secPSDfactor = winFactor /
x->length * 0.5 *
Tsft, sum = 0.0;
859 for (
UINT4 ii = 0; ii < templatespan; ii++ ) {
863 INT4 bins2middlebin = ii + templatemin;
867 REAL4 rowpowersum = 0.0;
868 for (
UINT4 jj = 0; jj <
x->length; jj++ ) {
869 rowpowersum += psd1->
data[ii * numffts + jj];
871 if ( rowpowersum > 1.187167e-34 ) {
878 memcpy(
x->data, &( psd1->
data[ii * numffts] ),
sizeof(
REAL4 )*
x->length );
889 for (
UINT4 jj = 4; jj <
psd->length; jj++ ) {
893 if (
psd->data[jj] >
output->templatedata->data[
output->templatedata->length - 1] ) {
906 for (
UINT4 ii = 0; ii < minTemplateLength; ii++ ) {
909 UINT4 counter = minTemplateLength;
910 while ( counter < output->templatedata->length &&
output->templatedata->data[counter] >=
epsval_float( (
REAL4 )sum ) ) {
911 sum += (
REAL8 )
output->templatedata->data[counter];
914 for ( ; counter <
output->templatedata->length; counter++ ) {
915 output->templatedata->data[counter] = 0.0;
941 INT4 insertionpoint =
output->templatedata->length - 1;
942 INT4 numbertomove = 0;
943 while ( insertionpoint > 0 && weight >
output->templatedata->data[insertionpoint - 1] ) {
948 if ( insertionpoint < (
INT4 )
output->templatedata->length - 1 ) {
949 memmove( &(
output->templatedata->data[insertionpoint + 1] ), &(
output->templatedata->data[insertionpoint] ),
sizeof(
REAL4 )*numbertomove );
950 memmove( &(
output->pixellocations->data[insertionpoint + 1] ), &(
output->pixellocations->data[insertionpoint] ),
sizeof(
INT4 )*numbertomove );
953 output->templatedata->data[insertionpoint] = weight;
954 output->pixellocations->data[insertionpoint] = pixelloc;
965 if ( fabs(
x *
x - 1.0 ) < 1.0e-8 ) {
968 if ( fabs(
x ) < 1.0e-8 ) {
973 REAL4 sinpix = 0.0, cospix = 0.0;
975 if ( sinpix > 1.0 ) {
977 }
else if ( sinpix < -1.0 ) {
980 return sinpix / ( pix * (
x *
x - 1.0 ) );
REAL4 epsval_float(REAL4 val)
const double scale
multiplicative scaling factor of the coordinate
UINT4 max_index_in_range(const REAL4VectorAligned *vector, const UINT4 startlocation, const UINT4 lastlocation)
Determine the index value of the maximum value between elements of a REAL4VectorAligned (inclusive)
void * XLALMalloc(size_t n)
REAL4FFTPlan * XLALCreateForwardREAL4FFTPlan(UINT4 size, int measurelvl)
void XLALDestroyREAL4FFTPlan(REAL4FFTPlan *plan)
int XLALREAL4PowerSpectrum(REAL4Vector *_LAL_RESTRICT_ spec, const REAL4Vector *_LAL_RESTRICT_ data, const REAL4FFTPlan *plan)
int XLALSinCosLUT(REAL4 *sinx, REAL4 *cosx, REAL8 x)
Calculate sin(x) and cos(x) to roughly 1e-7 precision using a lookup-table and Taylor-expansion.
int XLALSinCos2PiLUT(REAL4 *sin2pix, REAL4 *cos2pix, REAL8 x)
Calculate sin(2*pi*x) and cos(2*pi*x) to roughly 1e-7 precision using a lookup-table and Taylor-expan...
INT4Vector * XLALCreateINT4Vector(UINT4 length)
void XLALDestroyINT4Vector(INT4Vector *vector)
REAL8Vector * XLALCreateREAL8Vector(UINT4 length)
void XLALDestroyREAL8Vector(REAL8Vector *vector)
int XLALVectorScaleREAL4(REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len)
void XLALDestroyREAL4VectorAligned(REAL4VectorAligned *in)
REAL4VectorAligned * XLALCreateREAL4VectorAligned(const UINT4 length, const UINT4 align)
int XLALVectorSinCos2PiREAL4(REAL4 *out1, REAL4 *out2, const REAL4 *in, const UINT4 len)
int XLALVectorExpREAL4(REAL4 *out, const REAL4 *in, const UINT4 len)
int XLALVectorMultiplyREAL4(REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
int XLALVectorShiftREAL4(REAL4 *out, REAL4 scalar, const REAL4 *in, const UINT4 len)
void XLALDestroyREAL4Window(REAL4Window *window)
REAL4Window * XLALCreateHannREAL4Window(UINT4 length)
#define XLAL_ERROR_VOID(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_REAL8(assertion,...)
#define XLAL_CHECK_NULL(assertion,...)
REAL4VectorAligned ** data
INT4Vector * pixellocations
REAL4VectorAligned * templatedata
INT4 makeTemplate(TwoSpectTemplate *output, const candidate input, const UserInput_t *params, const REAL4FFTPlan *plan)
Make an template based on FFT of sinc squared functions.
INT4 writeTwoSpectTemplateVector(const TwoSpectTemplateVector *vector, const CHAR *filename)
Write a TwoSpectTemplateVector to binary file.
void insertionSort_template(TwoSpectTemplate *output, const REAL4 weight, const INT4 pixelloc)
Insertion sort for the template weights.
TwoSpectTemplateVector * generateTwoSpectTemplateVector(const REAL8 Pmin, const REAL8 Pmax, const REAL8 dfmin, const REAL8 dfmax, const REAL8 Tsft, const REAL8 SFToverlap, const REAL8 Tobs, const UINT4 maxvectorlength, const UINT4 minTemplateLength, const UINT4 maxTemplateLength, const UINT4 vectormathflag, const BOOLEAN exactflag)
Generate a TwoSpectTemplateVector containing the template data.
void resetTwoSpectTemplate(TwoSpectTemplate *template)
Reset the values in a TwoSpectTemplate.
TwoSpectTemplateVector * createTwoSpectTemplateVector(const UINT4 length, const UINT4 templateLength)
Create a TwoSpectTemplateVector.
INT4 makeTemplate2(TwoSpectTemplate *output, const REAL8 offset, const REAL8 P, const REAL8 deltaf, const REAL8 Tsft, const REAL8 SFToverlap, const REAL8 Tobs, const UINT4 minTemplateLength, const UINT4 vectormathflag, const REAL4FFTPlan *plan)
Make an template based on FFT of sinc squared functions.
TwoSpectTemplate * createTwoSpectTemplate(const UINT4 length)
Allocate a new TwoSpectTemplate.
void destroyTwoSpectTemplateVector(TwoSpectTemplateVector *vector)
Free a TwoSpectTemplateVector.
TwoSpectTemplateVector * readTwoSpectTemplateVector(const CHAR *filename)
Read a TwoSpectTemplateVector from a binary file.
REAL8 sqsincxoverxsqminusone(const REAL8 x)
Calculate [sin(pi*x)/(pi*x)/(x^2-1)]^2.
REAL8 sincxoverxsqminusone(const REAL8 x)
Calculate sin(pi*x)/(pi*x)/(x^2-1)
void destroyTwoSpectTemplate(TwoSpectTemplate *template)
Free a TwoSpectTemplate.
INT4 makeTemplateGaussians2(TwoSpectTemplate *output, const REAL8 offset, const REAL8 P, const REAL8 deltaf, const REAL8 Tsft, const REAL8 SFToverlap, const REAL8 Tobs, const UINT4 minTemplateLength, const UINT4 vectormathflag)
Make an estimated template based on FFT of train of Gaussians.
INT4 convertTemplateForSpecificFbin(TwoSpectTemplate *output, const TwoSpectTemplate *input, const REAL8 freq, const UserInput_t *params)
Convert an arbitrary frequency bin template into a template for a specific frequency bin.
INT4 makeTemplateGaussians(TwoSpectTemplate *output, const candidate input, const UserInput_t *params)
Make an estimated template based on FFT of train of Gaussians.
INT4 VectorAbsREAL4(REAL4VectorAligned *output, REAL4VectorAligned *input, INT4 vectorMath)
INT4 VectorShiftREAL8(alignedREAL8Vector *output, alignedREAL8Vector *input, REAL8 shift, INT4 vectorMath)
void destroyAlignedREAL8Vector(alignedREAL8Vector *vector)
REAL4VectorAlignedArray * createREAL4VectorAlignedArray(const UINT4 length, const UINT4 vectorLength, const size_t align)
void destroyREAL4VectorAlignedArray(REAL4VectorAlignedArray *array)
alignedREAL8Vector * createAlignedREAL8Vector(UINT4 length, const size_t align)