LAL  7.5.0.1-b72065a

Detailed Description

This header covers the routines for interpolation.

Synopsis

#include <lal/Interpolate.h>

Description

The routine LALSPolynomialInterpolation() computes the interpolated \(y\) value output at the \(x\) value target by fitting a polynomial of order params.n-1 to the data. The result output is of type SInterpolateOut, which contains the value output.y as well as an estimate of the error output.dy. The routine LALDPolynomialInterpolation() is the same but for double precision.

Operating Instructions

The following program fits a fourth-order polynomial to the five data points \(\{(0,0),(1,1),(2,3),(3,4),(4,3)\}\), and interpolates the value at \(x=2.4\).

#include <lal/LALStdlib.h>
#include <lal/Interpolate.h>
int main ()
{
enum { ArraySize = 5 };
REAL4 x[ArraySize] = {0,1,2,3,4};
REAL4 y[ArraySize] = {0,1,3,4,3};
REAL4 target = 2.4;
SInterpolatePar intpar = {ArraySize, x, y};
LALSPolynomialInterpolation( &status, &intout, target, &intpar );
return 0;
}
int main(int argc, char *argv[])
Definition: cache.c:25
void LALSPolynomialInterpolation(LALStatus *status, SInterpolateOut *output, REAL4 target, SInterpolatePar *params)
Definition: Interpolate.c:29
float REAL4
Single precision real floating-point number (4 bytes).
LAL status structure, see The LALStatus structure for more details.
Definition: LALDatatypes.h:947
These structures contain the output of the interpolation.
Definition: Interpolate.h:105
These structures contain the interpolation parameters; These are the arrays of n domain values and t...
Definition: Interpolate.h:127

Algorithm

This is an implementation of the Neville algroithm, see polint in Numerical Recipes [22] .

Prototypes

void LALSPolynomialInterpolation (LALStatus *status, SInterpolateOut *output, REAL4 target, SInterpolatePar *params)
 
void LALDPolynomialInterpolation (LALStatus *status, DInterpolateOut *output, REAL8 target, DInterpolatePar *params)
 
REAL8 XLALREAL8PolynomialInterpolation (REAL8 *yout, REAL8 xtarget, REAL8 *y, REAL8 *x, UINT4 n)
 
int XLALREAL8Interpolation (REAL8Sequence *x_in, REAL8Sequence *y_in, REAL8Sequence *x_out, REAL8Sequence *y_out, UINT4 n_data_points, const gsl_interp_type *itrp_type)
 
int XLALREAL8TimeSeriesInterpolation (REAL8TimeSeries *ts_in, REAL8Sequence *y_in, REAL8Sequence *t_in, REAL8Sequence *t_out, UINT4 n_data_points, const gsl_interp_type *itrp_type)
 

Data Structures

struct  SInterpolateOut
 These structures contain the output of the interpolation. More...
 
struct  DInterpolateOut
 These structures contain the output of the interpolation. More...
 
struct  SInterpolatePar
 These structures contain the interpolation parameters; These are the arrays of n domain values \(x[0] \ldots x[n-1]\) and their corresponding values \(y[0] \ldots y[n-1]\). More...
 
struct  DInterpolatePar
 These structures contain the interpolation parameters; These are the arrays of n domain values \(x[0]\ldots x[n-1]\) and their corresponding values \(y[0]\ldots y[n-1]\). More...
 

Files

file  InterpolateTest.c
 Tests the routines in Interpolate.h.
 

Error Codes

#define INTERPOLATEH_ENULL   1
 Null pointer. More...
 
#define INTERPOLATEH_ESIZE   2
 Invalid size. More...
 
#define INTERPOLATEH_EZERO   4
 Zero divide. More...
 

Function Documentation

◆ LALSPolynomialInterpolation()

void LALSPolynomialInterpolation ( LALStatus status,
SInterpolateOut output,
REAL4  target,
SInterpolatePar params 
)
See also
See Header Interpolate.h for documentation

Definition at line 29 of file Interpolate.c.

◆ LALDPolynomialInterpolation()

void LALDPolynomialInterpolation ( LALStatus status,
DInterpolateOut output,
REAL8  target,
DInterpolatePar params 
)
See also
See Header Interpolate.h for documentation

Definition at line 115 of file Interpolate.c.

◆ XLALREAL8PolynomialInterpolation()

REAL8 XLALREAL8PolynomialInterpolation ( REAL8 yout,
REAL8  xtarget,
REAL8 y,
REAL8 x,
UINT4  n 
)
See also
See Header Interpolate.h for documentation

Definition at line 140 of file Interpolate.c.

◆ XLALREAL8Interpolation()

int XLALREAL8Interpolation ( REAL8Sequence x_in,
REAL8Sequence y_in,
REAL8Sequence x_out,
REAL8Sequence y_out,
UINT4  n_data_points,
const gsl_interp_type *  itrp_type 
)

Definition at line 228 of file Interpolate.c.

◆ XLALREAL8TimeSeriesInterpolation()

int XLALREAL8TimeSeriesInterpolation ( REAL8TimeSeries ts_in,
REAL8Sequence y_in,
REAL8Sequence t_in,
REAL8Sequence t_out,
UINT4  n_data_points,
const gsl_interp_type *  itrp_type 
)

Definition at line 282 of file Interpolate.c.

Macro Definition Documentation

◆ INTERPOLATEH_ENULL

#define INTERPOLATEH_ENULL   1

Null pointer.

Definition at line 91 of file Interpolate.h.

◆ INTERPOLATEH_ESIZE

#define INTERPOLATEH_ESIZE   2

Invalid size.

Definition at line 92 of file Interpolate.h.

◆ INTERPOLATEH_EZERO

#define INTERPOLATEH_EZERO   4

Zero divide.

Definition at line 93 of file Interpolate.h.