mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::math::gslInterpolator< interpT > Class Template Reference

template<typename interpT>
class mx::math::gslInterpolator< interpT >

Class to manage interpolation using the GSL interpolation library.

Template Parameters
interpTis the interpolation type, which also specifies the floating point precision.

Definition at line 81 of file gslInterpolator.hpp.

#include <math/gslInterpolator.hpp>

Public Member Functions

 gslInterpolator ()
 Default constructor. More...
 
 gslInterpolator (realT *xin, realT *yin, size_t Nin)
 Raw pointer constructor
More...
 
 gslInterpolator (std::vector< realT > &xin, std::vector< realT > &yin)
 Vector constructor. More...
 
 ~gslInterpolator ()
 Destructor. More...
 
void setup (realT *xin, realT *yin, size_t Nin)
 Setup the interpolator for the supplied data pointers. More...
 
void setup (std::vector< realT > &xin, std::vector< realT > &yin)
 Setup the interpolator for the supplied data vectors. More...
 
realT operator() (const realT &x)
 Calculate the interpolated function value at a point. More...
 

Protected Attributes

gsl_interp * m_interp {nullptr}
 the gsl interpolator structure More...
 
gsl_interp_accel * m_acc {nullptr}
 the gsl interpolation accelerator structure More...
 
realT * m_xin
 the input x data More...
 
realT * m_yin
 the input y data More...
 

Constructor & Destructor Documentation

◆ gslInterpolator() [1/3]

template<typename interpT >
mx::math::gslInterpolator< interpT >::gslInterpolator

Default constructor.

Definition at line 146 of file gslInterpolator.hpp.

◆ gslInterpolator() [2/3]

template<typename interpT >
mx::math::gslInterpolator< interpT >::gslInterpolator ( realT *  xin,
realT *  yin,
size_t  Nin 
)

Raw pointer constructor

Parameters
[in]xinthe input x data, this pointer is stored and must remain valid
[in]yinthe input y data, this pointer is stored and must remain valid
[in]Ninthe size of data vectors

Definition at line 151 of file gslInterpolator.hpp.

◆ gslInterpolator() [3/3]

template<typename interpT >
mx::math::gslInterpolator< interpT >::gslInterpolator ( std::vector< realT > &  xin,
std::vector< realT > &  yin 
)

Vector constructor.

Parameters
[in]xinthe input x data, the pointer to xin.data() is stored and xin must remain unchanged
[in]yinthe input y data, the pointer to yin.data() is stored and yin must remain unchanged

Definition at line 160 of file gslInterpolator.hpp.

◆ ~gslInterpolator()

template<typename interpT >
mx::math::gslInterpolator< interpT >::~gslInterpolator

Destructor.

Deallocates working memory.

Definition at line 168 of file gslInterpolator.hpp.

Member Function Documentation

◆ operator()()

template<typename interpT >
interpT::realT mx::math::gslInterpolator< interpT >::operator() ( const realT &  x)

Calculate the interpolated function value at a point.

Returns
the interpolated value at x
Parameters
[in]xthe point at which to interpolate

Definition at line 219 of file gslInterpolator.hpp.

◆ setup() [1/2]

template<typename interpT >
void mx::math::gslInterpolator< interpT >::setup ( realT *  xin,
realT *  yin,
size_t  Nin 
)

Setup the interpolator for the supplied data pointers.

Exceptions
mx::err::allocerrif allocation fails
mx::err::liberrif GSL initialization fails
Parameters
[in]xinthe input x data, this pointer is stored and must remain valid
[in]yinthe input y data, this pointer is stored and must remain valid
[in]Ninthe size of data vectors

Definition at line 175 of file gslInterpolator.hpp.

◆ setup() [2/2]

template<typename interpT >
void mx::math::gslInterpolator< interpT >::setup ( std::vector< realT > &  xin,
std::vector< realT > &  yin 
)

Setup the interpolator for the supplied data vectors.

Exceptions
mx::err::sizeerrif the vectors are not the same size
mx::err::allocerrif allocation fails
mx::err::liberrif GSL initialization fails
Parameters
[in]xinthe input x data, the pointer to xin.data() is stored and xin must remain unchanged
[in]yinthe input y data, the pointer to yin.data() is stored and yin must remain unchanged

Definition at line 207 of file gslInterpolator.hpp.

Member Data Documentation

◆ m_acc

template<typename interpT >
gsl_interp_accel* mx::math::gslInterpolator< interpT >::m_acc {nullptr}
protected

the gsl interpolation accelerator structure

Definition at line 91 of file gslInterpolator.hpp.

◆ m_interp

template<typename interpT >
gsl_interp* mx::math::gslInterpolator< interpT >::m_interp {nullptr}
protected

the gsl interpolator structure

Definition at line 90 of file gslInterpolator.hpp.

◆ m_xin

template<typename interpT >
realT* mx::math::gslInterpolator< interpT >::m_xin
protected

the input x data

Definition at line 93 of file gslInterpolator.hpp.

◆ m_yin

template<typename interpT >
realT* mx::math::gslInterpolator< interpT >::m_yin
protected

the input y data

Definition at line 94 of file gslInterpolator.hpp.


The documentation for this class was generated from the following file: