Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALInference 4.1.9.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cubic_interp.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015-2017 Leo Singer
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 *
19 *
20 * Accelerated 1D and 2D cubic interpolation
21 * 1. Constant boundary conditions
22 * 2. Robust to invalid data: drops to linear or nearest-neighbor
23 * when the input data contains NaNs or infinities
24 * 3. Bounds and invalid value checks are precomputed:
25 * minimal branch instructions needed in evaluate function
26 * 5. Interpolating polynomial is precomputed:
27 * modest speedup relative to naive 1D interpolant,
28 * 4x speedup over relative to naive 2D interpolant
29 * at the cost of 16x the memory footprint
30 */
31
32
33#ifndef CUBIC_INTERP_H
34#define CUBIC_INTERP_H
35
36/* exclude from SWIG interface and C++ code */
37#if !defined(SWIG) && !defined(__cplusplus)
38
39typedef struct tagcubic_interp {
40 double f, t0, length;
41 double a[][4];
43
44typedef struct tagbicubic_interp {
45 double fs, ft, s0, t0, slength, tlength;
46 double a[][4][4];
48
50 const double *data, int n, double tmin, double dt);
51
53
54double cubic_interp_eval(const cubic_interp *interp, double t);
55
57 const double *data, int ns, int nt,
58 double smin, double tmin, double ds, double dt);
59
61
62double bicubic_interp_eval(const bicubic_interp *interp, double s, double t);
63
64#endif /* !defined(SWIG) && !defined(__cplusplus) */
65
66#endif /* CUBIC_INTEPR_H */
bicubic_interp * bicubic_interp_init(const double *data, int ns, int nt, double smin, double tmin, double ds, double dt)
Definition: cubic_interp.c:136
void cubic_interp_free(cubic_interp *interp)
Definition: cubic_interp.c:120
void bicubic_interp_free(bicubic_interp *interp)
Definition: cubic_interp.c:187
double bicubic_interp_eval(const bicubic_interp *interp, double s, double t)
Definition: cubic_interp.c:193
cubic_interp * cubic_interp_init(const double *data, int n, double tmin, double dt)
Definition: cubic_interp.c:95
double cubic_interp_eval(const cubic_interp *interp, double t)
Definition: cubic_interp.c:126
static REAL8 cubic_interp(REAL8 xout, REAL8 *x, REAL8 *y)
static const INT4 a
ns
double t0