GCpp general purpose C++ library  version 1.0
GInterpolation.hh File Reference
#include <math.h>
#include "GGlobal.hh"
#include "GBaseFunctions.hh"
#include "GLogMessage.hh"

Go to the source code of this file.

Functions

int GArrayInterpolationLinear (const u_int Nin, const double Yin[], const u_int Nout, double Yout[], const double X0, const double dX)
 
int GArrayInterpolationLinear (const u_int Nin, const double Yin[], const double Xin0, const double dXin, const u_int Nout, double Yout[], const double Xout0, const double dXout)
 
int GArrayInterpolationCubic (const u_int Nin, const double Yin[], const u_int Nout, double Yout[], const double X0, const double dX)
 
int GArrayInterpolationCubic (const u_int Nin, const double Yin[], const double Xin0, const double dXin, const u_int Nout, double Yout[], const double Xout0, const double dXout)
 

Detailed Description

Include file for interpolation functions.

Function Documentation

int GArrayInterpolationCubic ( const u_int  Nin,
const double  Yin[],
const u_int  Nout,
double  Yout[],
const double  X0,
const double  dX 
)

Computes the output array Yout from a cubic interpolation of the input array Yin.

The input array is interpreted as a serie of Nin points with coordinates (x,y) = ( i, Yin[i] ), which means the fist point is at X=0 and the step on the X axis is 1. The output array as points with coordinates (x,y) = ( X0+j*dX, Yout[j] ).

If some of the output points are outside the input range [0:Nin-1], the result for those points will be an extrapolation from the first or last interval.

The function returns 0 if no error occured. The input array must have a dimension of at least 2, and the output one must be at leat 1 point.

Parameters
Ninsize of the input array
Yininput array
Noutsize of the output array
Youtoutput array
X0X-position of the first point of the output array
dXoutput array step value

References GLogWarning().

Referenced by GArrayInterpolationCubic(), GRealSampleFFT::InterpolateFrom(), and GRealSampleFFT::SetTimeResponse().

int GArrayInterpolationCubic ( const u_int  Nin,
const double  Yin[],
const double  Xin0,
const double  dXin,
const u_int  Nout,
double  Yout[],
const double  Xout0,
const double  dXout 
)

Computes the output array Yout from a cubic interpolation of the input array Yin.

The input array is interpreted as a serie of Nin points with coordinates (x,y) = ( Xin0+j*dXin, Yin[i] ). The output array as points with coordinates (x,y) = ( Xout0+j*dXout, Yout[j] ).

If some of the output points are outside the input range [0:Nin-1], the result for those points will be an extrapolation from the first or last interval.

The function returns 0 if no error occured. The input array must have a dimension of at least 2, and the output one must be at leat 1 point.

Parameters
Ninsize of the input array
Yininput array
Xin0X-position of the first point of the input array
dXininput array step value
Noutsize of the output array
Youtoutput array
Xout0X-position of the first point of the output array
dXoutoutput array step value

References GArrayInterpolationCubic(), and GLogWarning().

int GArrayInterpolationLinear ( const u_int  Nin,
const double  Yin[],
const u_int  Nout,
double  Yout[],
const double  X0,
const double  dX 
)

Computes the output array Yout from a linear interpolation of the input array Yin.

The input array is interpreted as a serie of Nin points with coordinates (x,y) = ( i, Yin[i] ), which means the fist point is at X=0 and the step on the X axis is 1. The output array as points with coordinates (x,y) = ( X0+j*dX, Yout[j] ).

If some of the output points are outside the input range [0:Nin-1], the result for those points will be an extrapolation from the first or last interval.

The function returns 0 if no error occured. The input array must have a dimension of at least 2, and the output one must be at leat 1 point.

Parameters
Ninsize of the input array
Yininput array
Noutsize of the output array
Youtoutput array
X0X-position of the first point of the output array
dXoutput array step value

References GLogWarning().

Referenced by GArrayInterpolationLinear(), GRealSampleFFT::InterpolateFrom(), and GRealSampleFFT::SetTimeResponse().

int GArrayInterpolationLinear ( const u_int  Nin,
const double  Yin[],
const double  Xin0,
const double  dXin,
const u_int  Nout,
double  Yout[],
const double  Xout0,
const double  dXout 
)

Computes the output array Yout from a linear interpolation of the input array Yin.

The input array is interpreted as a serie of Nin points with coordinates (x,y) = ( Xin0+j*dXin, Yin[i] ). The output array as points with coordinates (x,y) = ( Xout0+j*dXout, Yout[j] ).

If some of the output points are outside the input range [0:Nin-1], the result for those points will be an extrapolation from the first or last interval.

The function returns 0 if no error occured. The input array must have a dimension of at least 2, and the output one must be at leat 1 point.

Parameters
Ninsize of the input array
Yininput array
Xin0X-position of the first point of the input array
dXininput array step value
Noutsize of the output array
Youtoutput array
Xout0X-position of the first point of the output array
dXoutoutput array step value

References GArrayInterpolationLinear(), and GLogWarning().