LAL  7.5.0.1-08ee4f4
TriggerInterpolation.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with with program; see the file COPYING. If not, write to the
14  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15  * MA 02110-1301 USA
16  *
17  * Copyright (C) 2012 Leo Singer
18  */
19 
20 #include <complex.h>
21 #include <string.h>
22 
23 #include <gsl/gsl_errno.h>
24 #include <gsl/gsl_multifit.h>
25 #include <gsl/gsl_min.h>
26 #include <gsl/gsl_nan.h>
27 #include <gsl/gsl_poly.h>
28 #include <gsl/gsl_sf_trig.h>
29 
30 #include <lal/TriggerInterpolation.h>
31 
32 
33 /*
34  * Helpers for declaring apply functions for other data types
35  */
36 
37 
38 typedef int (*XLALCOMPLEX16ApplyFunc)(void *, double *, COMPLEX16 *, const COMPLEX16 *);
39 
40 
42  void *interp,
43  XLALCOMPLEX16ApplyFunc applyfunc,
44  int window,
45  double *tmax,
46  COMPLEX8 *ymax,
47  const COMPLEX8 *y)
48 {
49  int i;
50  int ret;
51  double tmax_full;
52  COMPLEX16 ymax_full;
53  COMPLEX16 data_full[2 * window + 1];
54  COMPLEX16 *y_full = &data_full[window];
55 
56  for (i = -window; i <= window; i ++)
57  y_full[i] = y[i];
58 
59  ret = applyfunc(interp, &tmax_full, &ymax_full, y_full);
60  if (ret == GSL_SUCCESS)
61  {
62  *tmax = tmax_full;
63  *ymax = ymax_full;
64  }
65  return ret;
66 }
67 
68 
70  void *interp,
71  XLALCOMPLEX16ApplyFunc applyfunc,
72  int window,
73  double *tmax,
74  REAL8 *ymax,
75  const REAL8 *y)
76 {
77  int i;
78  int ret;
79  double tmax_full;
80  COMPLEX16 ymax_full;
81  COMPLEX16 data_full[2 * window + 1];
82  COMPLEX16 *y_full = &data_full[window];
83 
84  for (i = -window; i <= window; i ++)
85  y_full[i] = y[i];
86 
87  ret = applyfunc(interp, &tmax_full, &ymax_full, y_full);
88  if (ret == GSL_SUCCESS)
89  {
90  *tmax = tmax_full;
91  *ymax = creal(ymax_full);
92  }
93  return ret;
94 }
95 
96 
98  void *interp,
99  XLALCOMPLEX16ApplyFunc applyfunc,
100  int window,
101  double *tmax,
102  REAL4 *ymax,
103  const REAL4 *y)
104 {
105  int i;
106  int ret;
107  double tmax_full;
108  COMPLEX16 ymax_full;
109  COMPLEX16 data_full[2 * window + 1];
110  COMPLEX16 *y_full = &data_full[window];
111 
112  for (i = -window; i <= window; i ++)
113  y_full[i] = y[i];
114 
115  ret = applyfunc(interp, &tmax_full, &ymax_full, y_full);
116  if (ret == GSL_SUCCESS)
117  {
118  *tmax = tmax_full;
119  *ymax = creal(ymax_full);
120  }
121  return ret;
122 }
123 
124 
125 /*
126  * General functions
127  */
128 
129 
130 /* Return |z|^2 for a complex number z. */
131 static double cabs2(COMPLEX16 z)
132 {
133  return gsl_pow_2(creal(z)) + gsl_pow_2(cimag(z));
134 }
135 
136 
137 /*
138  * CubicSpline
139  */
140 
141 
142 /* Provide declaration of opaque data structure to hold Lanzos interpolant state. */
144  gsl_poly_complex_workspace *workspace;
145 };
146 
147 
148 /* Data structure providing arguments for minimizer cost function. */
149 typedef struct {
150  const COMPLEX16 *data;
151  unsigned int window;
153 
154 
155 /* Strip leading zero coefficients of a polynomial.
156  * Pass the number of coefficients as n. The new number of coefficients is returned. */
157 static size_t poly_strip(const double *a, size_t n)
158 {
159  for (; n > 0 && a[n - 1] == 0; n--)
160  ; /* loop body intentionally a no-op */
161  return n;
162 }
163 
164 
165 /* Polynomial multiply-accumulate. */
166 static void poly_mac(double *y, const double *a, size_t na, const double *b, size_t nb)
167 {
168  size_t ia, ib;
169 
170  /* Compute convolution. */
171  for (ia = 0; ia < na; ia++)
172  for (ib = 0; ib < nb; ib++)
173  y[ia + ib] += a[ia] * b[ib];
174 }
175 
176 
177 /* Compute derivative of a polynomial. */
178 static void poly_der(double *a, size_t n)
179 {
180  size_t i;
181  for (i = 0; i < n; i ++)
182  a[i] *= i;
183 }
184 
185 
186 /* Construct inteprolating polynomial. */
187 static void poly_interp(double *a, const double y_0, const double y_1, const double y_2, const double y_3)
188 {
189  a[3] = 0.5 * (y_3 - y_0) + 1.5 * (y_1 - y_2);
190  a[2] = y_0 - 2.5 * y_1 + 2 * y_2 - 0.5 * y_3;
191  a[1] = 0.5 * (y_2 - y_0);
192  a[0] = y_1;
193 }
194 
195 
196 /**
197  * Treat \c are and \c aim as the real and imaginary parts of a polynomial with
198  * \n complex coefficients. Find all local extrema of the absolute value of the
199  * polynomial.
200  */
201 static int interp_find_roots(size_t *nroots, COMPLEX16 *roots, const double *are, const double *aim, size_t n, gsl_poly_complex_workspace *workspace)
202 {
203  int ret = GSL_EFAILED;
204  double b[2 * n - 2];
205 
206  /* Compute the coefficients of the polynomial
207  * b = D[|a|^2 + |b|^2, t]. */
208  {
209  double ad[n];
210  memset(b, 0, sizeof(double) * (2 * n - 2));
211 
212  memcpy(ad, are, sizeof(double) * n);
213  poly_der(ad, n);
214  poly_mac(b, &ad[1], n - 1, are, n);
215 
216  memcpy(ad, aim, sizeof(double) * n);
217  poly_der(ad, n);
218  poly_mac(b, &ad[1], n - 1, aim, n);
219  }
220 
221  n = poly_strip(b, 2 * n - 2);
222 
223  if (n == 0) {
224  *nroots = 0;
225  return GSL_SUCCESS;
226  }
227 
228  ret = gsl_poly_complex_solve(b, n, workspace, (double *) roots);
229  if (ret == GSL_SUCCESS)
230  *nroots = n - 1;
231 
232  return ret;
233 }
234 
235 
236 /**
237  * Perform cubic spline interpolation of a trigger. Since cubic splines
238  * inherently take into account an even number of samples, we are going to
239  * have to call this function twice: once for the first four of the five samples
240  * surrounding the trigger and once for the last four of the five samples
241  * surrounding the trigger.
242  */
243 static int cubic_interp_1(gsl_poly_complex_workspace *workspace, double *t, COMPLEX16 *val, const COMPLEX16 *y)
244 {
245  double argmax = NAN, new_argmax;
246  COMPLEX16 maxval, new_maxval;
247  double max_abs2, new_max_abs2;
248 
249  size_t n = 4;
250  double are[n], aim[n];
251  COMPLEX16 roots[2 * n - 3];
252 
253  size_t nroots, iroot;
254  int result;
255 
256  /* Compute coefficients of interpolating polynomials for real and imaginary
257  * parts of data. */
258  poly_interp(are, creal(y[0]), creal(y[1]), creal(y[2]), creal(y[3]));
259  poly_interp(aim, cimag(y[0]), cimag(y[1]), cimag(y[2]), cimag(y[3]));
260 
261  /* Find local maxima of (|a|^2 + |b|^2). */
262  result = interp_find_roots(&nroots, roots, are, aim, n, workspace);
263  if (result != GSL_SUCCESS)
264  return result;
265 
266  /* Determine which of the endpoints is greater. */
267  argmax = 0;
268  maxval = y[1];
269  max_abs2 = cabs2(maxval);
270 
271  new_argmax = 1;
272  new_maxval = y[2];
273  new_max_abs2 = cabs2(new_maxval);
274  if (new_max_abs2 > max_abs2) {
275  argmax = new_argmax;
276  maxval = new_maxval;
277  max_abs2 = new_max_abs2;
278  }
279 
280  /* See if there is a local extremum that is greater than the endpoints. */
281  for (iroot = 0; iroot < nroots; iroot++) {
282  /* Skip this root if it is complex. */
283  if (cimag(roots[iroot]) != 0)
284  continue;
285 
286  new_argmax = creal(roots[iroot]);
287 
288  /* Skip this root if it is outside of (0, 1) */
289  if (new_argmax <= 0 || new_argmax >= 1)
290  continue;
291 
292  new_maxval = gsl_poly_eval(are, n, new_argmax) + gsl_poly_eval(aim, n, new_argmax) * I;
293  new_max_abs2 = cabs2(new_maxval);
294 
295  if (new_max_abs2 > max_abs2) {
296  argmax = new_argmax;
297  maxval = new_maxval;
298  }
299  }
300 
301  *t = argmax;
302  *val = maxval;
303  return GSL_SUCCESS;
304 }
305 
306 
307 CubicSplineTriggerInterpolant *XLALCreateCubicSplineTriggerInterpolant(unsigned int window)
308 {
309  CubicSplineTriggerInterpolant *interp = calloc(1, sizeof(CubicSplineTriggerInterpolant));
310 
311  if (window < 2)
312  goto fail;
313 
314  if (!interp)
315  goto fail;
316 
317  interp->workspace = gsl_poly_complex_workspace_alloc(6);
318  if (!interp->workspace)
319  goto fail;
320 
321  return interp;
322 fail:
324  return NULL;
325 }
326 
327 
328 void XLALDestroyCubicSplineTriggerInterpolant(CubicSplineTriggerInterpolant *interp)
329 {
330  if (interp)
331  {
332  gsl_poly_complex_workspace_free(interp->workspace);
333  interp->workspace = NULL;
334  }
335  free(interp);
336 }
337 
338 
340  CubicSplineTriggerInterpolant *interp,
341  double *t,
342  COMPLEX16 *y,
343  const COMPLEX16 *data)
344 {
345  COMPLEX16 max1, max2;
346  double max1_abs1, max2_abs2;
347  double argmax1, argmax2;
348  int result;
349 
350  result = cubic_interp_1(interp->workspace, &argmax1, &max1, &data[-2]);
351  if (result != GSL_SUCCESS)
352  return result;
353  result = cubic_interp_1(interp->workspace, &argmax2, &max2, &data[-1]);
354  if (result != GSL_SUCCESS)
355  return result;
356  max1_abs1 = cabs2(max1);
357  max2_abs2 = cabs2(max2);
358 
359  if (max1_abs1 > max2_abs2) {
360  *t = argmax1 - 1;
361  *y = max1;
362  } else {
363  *t = argmax2;
364  *y = max2;
365  }
366 
367  return GSL_SUCCESS;
368 }
369 
370 
372  CubicSplineTriggerInterpolant *interp,
373  double *tmax,
374  COMPLEX8 *ymax,
375  const COMPLEX8 *y)
376 {
379  2, tmax, ymax, y);
380 }
381 
382 
384  CubicSplineTriggerInterpolant *interp,
385  double *tmax,
386  REAL8 *ymax,
387  const REAL8 *y)
388 {
389  return XLALREAL8ApplyTriggerInterpolant(interp,
391  2, tmax, ymax, y);
392 }
393 
394 
396  CubicSplineTriggerInterpolant *interp,
397  double *tmax,
398  REAL4 *ymax,
399  const REAL4 *y)
400 {
401  return XLALREAL4ApplyTriggerInterpolant(interp,
403  2, tmax, ymax, y);
404 }
405 
406 
407 /*
408  * Lanczos
409  */
410 
411 
412 /* Provide declaration of opaque data structure to hold Lanzos interpolant state. */
414  gsl_min_fminimizer *fminimizer;
415  unsigned int window;
416 };
417 
418 
419 /* Data structure providing arguments for minimizer cost function. */
420 typedef struct {
421  const COMPLEX16 *data;
422  unsigned int window;
424 
425 
426 /* The Lanczos kernel. */
427 static double lanczos(double t, double a)
428 {
429  return gsl_sf_sinc(t) * gsl_sf_sinc(t / a);
430 }
431 
432 
433 /* The Lanczos reconstruction filter interpolant. */
435 {
436  COMPLEX16 ret;
437  int i;
438 
439  for (ret = 0, i = -(int)params->window; i <= (int)params->window; i ++)
440  ret += lanczos(t - i, params->window) * params->data[i];
441 
442  return ret;
443 }
444 
445 
446 /* The cost function to minimize. */
447 static double lanczos_cost(double t, void *params)
448 {
449  return -cabs2(lanczos_interpolant(t, params));
450 }
451 
452 
453 LanczosTriggerInterpolant *XLALCreateLanczosTriggerInterpolant(unsigned int window)
454 {
455  LanczosTriggerInterpolant *interp = calloc(1, sizeof(LanczosTriggerInterpolant));
456 
457  if (!interp)
458  goto fail;
459 
460  interp->fminimizer = gsl_min_fminimizer_alloc(gsl_min_fminimizer_brent);
461  if (!interp->fminimizer)
462  goto fail;
463 
464  interp->window = window;
465 
466  return interp;
467 fail:
469  return NULL;
470 }
471 
472 
473 void XLALDestroyLanczosTriggerInterpolant(LanczosTriggerInterpolant *interp)
474 {
475  if (interp)
476  {
477  gsl_min_fminimizer_free(interp->fminimizer);
478  interp->fminimizer = NULL;
479  }
480  free(interp);
481 }
482 
483 
485  LanczosTriggerInterpolant *interp,
486  double *t,
487  COMPLEX16 *y,
488  const COMPLEX16 *data)
489 {
490  static const double epsabs = 1e-5;
491 
492  LanczosTriggerInterpolantParams params = {data, interp->window};
493  gsl_function func = {lanczos_cost, &params};
494  double t1, t2;
495  int result;
496 
497  result = gsl_min_fminimizer_set_with_values(interp->fminimizer, &func,
498  0, -cabs2(data[0]), -1, -cabs2(data[-1]), 1, -cabs2(data[1]));
499  if (result != GSL_SUCCESS)
500  GSL_ERROR("failed to initialize minimizer", result);
501 
502  do {
503  result = gsl_min_fminimizer_iterate(interp->fminimizer);
504  if (result != GSL_SUCCESS)
505  GSL_ERROR("failed to perform minimizer iteration", result);
506 
507  t1 = gsl_min_fminimizer_x_lower(interp->fminimizer);
508  t2 = gsl_min_fminimizer_x_upper(interp->fminimizer);
509  } while (t2 - t1 > epsabs);
510 
511  *t = gsl_min_fminimizer_x_minimum(interp->fminimizer);
512  *y = lanczos_interpolant(*t, &params);
513 
514  return GSL_SUCCESS;
515 }
516 
517 
519  LanczosTriggerInterpolant *interp,
520  double *tmax,
521  COMPLEX8 *ymax,
522  const COMPLEX8 *y)
523 {
526  interp->window, tmax, ymax, y);
527 }
528 
529 
531  LanczosTriggerInterpolant *interp,
532  double *tmax,
533  REAL8 *ymax,
534  const REAL8 *y)
535 {
536  return XLALREAL8ApplyTriggerInterpolant(interp,
538  interp->window, tmax, ymax, y);
539 }
540 
541 
543  LanczosTriggerInterpolant *interp,
544  double *tmax,
545  REAL4 *ymax,
546  const REAL4 *y)
547 {
548  return XLALREAL4ApplyTriggerInterpolant(interp,
550  interp->window, tmax, ymax, y);
551 }
552 
553 
554 /*
555  * Nearest neighbor
556  */
557 
558 
560  unsigned int window;
561 };
562 
563 
564 NearestNeighborTriggerInterpolant *XLALCreateNearestNeighborTriggerInterpolant(unsigned int window)
565 {
566  NearestNeighborTriggerInterpolant *interp = calloc(1, sizeof(NearestNeighborTriggerInterpolant));
567 
568  if (!interp)
569  goto fail;
570 
571  if (window != 0)
572  goto fail;
573 
574  interp->window = window;
575 
576  return interp;
577 fail:
579  return NULL;
580 }
581 
582 
583 void XLALDestroyNearestNeighborTriggerInterpolant(NearestNeighborTriggerInterpolant *interp)
584 {
585  free(interp);
586 }
587 
588 
590  __attribute__ ((unused)) NearestNeighborTriggerInterpolant *interp,
591  double *t,
592  COMPLEX16 *y,
593  const COMPLEX16 *data)
594 {
595  *t = 0;
596  *y = data[0];
597  return GSL_SUCCESS;
598 }
599 
600 
602  NearestNeighborTriggerInterpolant *interp,
603  double *tmax,
604  COMPLEX8 *ymax,
605  const COMPLEX8 *y)
606 {
609  interp->window, tmax, ymax, y);
610 }
611 
612 
614  NearestNeighborTriggerInterpolant *interp,
615  double *tmax,
616  REAL8 *ymax,
617  const REAL8 *y)
618 {
619  return XLALREAL8ApplyTriggerInterpolant(interp,
621  interp->window, tmax, ymax, y);
622 }
623 
624 
626  NearestNeighborTriggerInterpolant *interp,
627  double *tmax,
628  REAL4 *ymax,
629  const REAL4 *y)
630 {
631  return XLALREAL4ApplyTriggerInterpolant(interp,
633  interp->window, tmax, ymax, y);
634 }
635 
636 
637 /*
638  * Quadratic fit
639  */
640 
641 
643  gsl_multifit_linear_workspace *workspace;
644  gsl_matrix *X;
645  gsl_matrix *cov;
646  gsl_vector *y;
647  gsl_vector *c;
648  unsigned int window;
649 };
650 
651 
652 QuadraticFitTriggerInterpolant *XLALCreateQuadraticFitTriggerInterpolant(unsigned int window)
653 {
654  QuadraticFitTriggerInterpolant *interp = calloc(1, sizeof(QuadraticFitTriggerInterpolant));
655  int i;
656 
657  if (!interp)
658  goto fail;
659 
660  if (window < 1)
661  goto fail;
662 
663  interp->window = window;
664 
665  interp->workspace = gsl_multifit_linear_alloc(2 * window + 1, 3);
666  if (!interp->workspace)
667  goto fail;
668 
669  interp->X = gsl_matrix_alloc(2 * window + 1, 3);
670  if (!interp->X)
671  goto fail;
672 
673  for (i = 0; i < 2 * (int)window + 1; i ++)
674  {
675  double x = i - window;
676  gsl_matrix_set(interp->X, i, 0, 1);
677  gsl_matrix_set(interp->X, i, 1, x);
678  gsl_matrix_set(interp->X, i, 2, gsl_pow_2(x));
679  }
680 
681  interp->cov = gsl_matrix_alloc(3, 3);
682  if (!interp->cov)
683  goto fail;
684 
685  interp->y = gsl_vector_alloc(2 * window + 1);
686  if (!interp->y)
687  goto fail;
688 
689  interp->c = gsl_vector_alloc(3);
690  if (!interp->c)
691  goto fail;
692 
693  interp->window = window;
694 
695  return interp;
696 fail:
698  return NULL;
699 }
700 
701 
702 void XLALDestroyQuadraticFitTriggerInterpolant(QuadraticFitTriggerInterpolant *interp)
703 {
704  if (interp)
705  {
706  gsl_multifit_linear_free(interp->workspace);
707  interp->workspace = NULL;
708  gsl_matrix_free(interp->X);
709  interp->X = NULL;
710  gsl_matrix_free(interp->cov);
711  interp->cov = NULL;
712  gsl_vector_free(interp->y);
713  interp->y = NULL;
714  gsl_vector_free(interp->c);
715  interp->c = NULL;
716  }
717  free(interp);
718 }
719 
720 
722  QuadraticFitTriggerInterpolant *interp,
723  double *t,
724  COMPLEX16 *y,
725  const COMPLEX16 *data)
726 {
727  int i;
728  int result;
729  double chisq;
730  double a, b, tmax;
731 
732  for (i = -(int)interp->window; i <= (int)interp->window; i ++)
733  gsl_vector_set(interp->y, i + interp->window, cabs(y[i]));
734 
735  result = gsl_multifit_linear(interp->X, interp->y, interp->c, interp->cov, &chisq, interp->workspace);
736  if (result != GSL_SUCCESS)
737  GSL_ERROR("regression failed", result);
738 
739  a = gsl_vector_get(interp->c, 2);
740  b = gsl_vector_get(interp->c, 1);
741  tmax = -0.5 * b / a;
742 
743  if ((a > 0 || (a == 0 && b > 0)) && tmax > -1 && tmax < 1)
744  *t = tmax;
745  else
746  *t = 0;
747 
748  *y = data[0];
749 
750  return GSL_SUCCESS;
751 }
752 
753 
755  QuadraticFitTriggerInterpolant *interp,
756  double *tmax,
757  COMPLEX8 *ymax,
758  const COMPLEX8 *y)
759 {
762  interp->window, tmax, ymax, y);
763 }
764 
765 
767  QuadraticFitTriggerInterpolant *interp,
768  double *tmax,
769  REAL8 *ymax,
770  const REAL8 *y)
771 {
772  return XLALREAL8ApplyTriggerInterpolant(interp,
774  interp->window, tmax, ymax, y);
775 }
776 
777 
779  QuadraticFitTriggerInterpolant *interp,
780  double *tmax,
781  REAL4 *ymax,
782  const REAL4 *y)
783 {
784  return XLALREAL4ApplyTriggerInterpolant(interp,
786  interp->window, tmax, ymax, y);
787 }
static double lanczos_cost(double t, void *params)
static int XLALCOMPLEX8ApplyTriggerInterpolant(void *interp, XLALCOMPLEX16ApplyFunc applyfunc, int window, double *tmax, COMPLEX8 *ymax, const COMPLEX8 *y)
static double lanczos(double t, double a)
int XLALCOMPLEX16ApplyNearestNeighborTriggerInterpolant(__attribute__((unused)) NearestNeighborTriggerInterpolant *interp, double *t, COMPLEX16 *y, const COMPLEX16 *data)
static int cubic_interp_1(gsl_poly_complex_workspace *workspace, double *t, COMPLEX16 *val, const COMPLEX16 *y)
Perform cubic spline interpolation of a trigger.
static void poly_der(double *a, size_t n)
static size_t poly_strip(const double *a, size_t n)
static void poly_mac(double *y, const double *a, size_t na, const double *b, size_t nb)
int(* XLALCOMPLEX16ApplyFunc)(void *, double *, COMPLEX16 *, const COMPLEX16 *)
static COMPLEX16 lanczos_interpolant(double t, const LanczosTriggerInterpolantParams *params)
static int interp_find_roots(size_t *nroots, COMPLEX16 *roots, const double *are, const double *aim, size_t n, gsl_poly_complex_workspace *workspace)
Treat are and aim as the real and imaginary parts of a polynomial with complex coefficients.
static double cabs2(COMPLEX16 z)
static int XLALREAL4ApplyTriggerInterpolant(void *interp, XLALCOMPLEX16ApplyFunc applyfunc, int window, double *tmax, REAL4 *ymax, const REAL4 *y)
static int XLALREAL8ApplyTriggerInterpolant(void *interp, XLALCOMPLEX16ApplyFunc applyfunc, int window, double *tmax, REAL8 *ymax, const REAL8 *y)
static void poly_interp(double *a, const double y_0, const double y_1, const double y_2, const double y_3)
#define __attribute__(x)
Definition: getdate.c:146
int XLALCOMPLEX8ApplyCubicSplineTriggerInterpolant(CubicSplineTriggerInterpolant *interp, double *tmax, COMPLEX8 *ymax, const COMPLEX8 *y)
CubicSplineTriggerInterpolant * XLALCreateCubicSplineTriggerInterpolant(unsigned int window)
Constructor.
int XLALCOMPLEX16ApplyCubicSplineTriggerInterpolant(CubicSplineTriggerInterpolant *interp, double *t, COMPLEX16 *y, const COMPLEX16 *data)
Perform interpolation using the allocated workspace.
void XLALDestroyCubicSplineTriggerInterpolant(CubicSplineTriggerInterpolant *interp)
Destructor.
int XLALREAL4ApplyCubicSplineTriggerInterpolant(CubicSplineTriggerInterpolant *interp, double *tmax, REAL4 *ymax, const REAL4 *y)
int XLALREAL8ApplyCubicSplineTriggerInterpolant(CubicSplineTriggerInterpolant *interp, double *tmax, REAL8 *ymax, const REAL8 *y)
double complex COMPLEX16
Double-precision floating-point complex number (16 bytes total)
double REAL8
Double precision real floating-point number (8 bytes).
float complex COMPLEX8
Single-precision floating-point complex number (8 bytes total)
float REAL4
Single precision real floating-point number (4 bytes).
int XLALREAL8ApplyLanczosTriggerInterpolant(LanczosTriggerInterpolant *interp, double *tmax, REAL8 *ymax, const REAL8 *y)
void XLALDestroyLanczosTriggerInterpolant(LanczosTriggerInterpolant *interp)
Destructor.
int XLALREAL4ApplyLanczosTriggerInterpolant(LanczosTriggerInterpolant *interp, double *tmax, REAL4 *ymax, const REAL4 *y)
int XLALCOMPLEX16ApplyLanczosTriggerInterpolant(LanczosTriggerInterpolant *interp, double *t, COMPLEX16 *y, const COMPLEX16 *data)
Perform interpolation using the allocated workspace.
int XLALCOMPLEX8ApplyLanczosTriggerInterpolant(LanczosTriggerInterpolant *interp, double *tmax, COMPLEX8 *ymax, const COMPLEX8 *y)
LanczosTriggerInterpolant * XLALCreateLanczosTriggerInterpolant(unsigned int window)
Constructor.
NearestNeighborTriggerInterpolant * XLALCreateNearestNeighborTriggerInterpolant(unsigned int window)
Constructor.
int XLALREAL4ApplyNearestNeighborTriggerInterpolant(NearestNeighborTriggerInterpolant *interp, double *tmax, REAL4 *ymax, const REAL4 *y)
int XLALREAL8ApplyNearestNeighborTriggerInterpolant(NearestNeighborTriggerInterpolant *interp, double *tmax, REAL8 *ymax, const REAL8 *y)
int XLALCOMPLEX8ApplyNearestNeighborTriggerInterpolant(NearestNeighborTriggerInterpolant *interp, double *tmax, COMPLEX8 *ymax, const COMPLEX8 *y)
void XLALDestroyNearestNeighborTriggerInterpolant(NearestNeighborTriggerInterpolant *interp)
Destructor.
int XLALREAL8ApplyQuadraticFitTriggerInterpolant(QuadraticFitTriggerInterpolant *interp, double *tmax, REAL8 *ymax, const REAL8 *y)
int XLALCOMPLEX16ApplyQuadraticFitTriggerInterpolant(QuadraticFitTriggerInterpolant *interp, double *t, COMPLEX16 *y, const COMPLEX16 *data)
Perform interpolation using the allocated workspace.
int XLALCOMPLEX8ApplyQuadraticFitTriggerInterpolant(QuadraticFitTriggerInterpolant *interp, double *tmax, COMPLEX8 *ymax, const COMPLEX8 *y)
void XLALDestroyQuadraticFitTriggerInterpolant(QuadraticFitTriggerInterpolant *interp)
Destructor.
QuadraticFitTriggerInterpolant * XLALCreateQuadraticFitTriggerInterpolant(unsigned int window)
Constructor.
int XLALREAL4ApplyQuadraticFitTriggerInterpolant(QuadraticFitTriggerInterpolant *interp, double *tmax, REAL4 *ymax, const REAL4 *y)
static const INT4 a
Definition: Random.c:79
gsl_poly_complex_workspace * workspace
gsl_multifit_linear_workspace * workspace