Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
qlibs::interp1 Class Reference

A 1D interpolation object. More...

#include <interp1.hpp>

Public Member Functions

virtual ~interp1 ()
 
 interp1 (const real_t *const xTable, const real_t *const yTable, const size_t sizeTable)
 Constructor for the 1D interpolation instance.
 
template<size_t sizeTable>
 interp1 (real_t(&xTable)[sizeTable], real_t(&yTable)[sizeTable])
 Constructor for the 1D interpolation instance.
 
bool setData (const real_t *const xTable, const real_t *const yTable, const size_t sizeTable)
 Set the data table for the 1D interpolation instance.
 
template<size_t sizeTable>
bool setData (real_t(&xTable)[sizeTable], real_t(&yTable)[sizeTable])
 Set the data for the 1D interpolation instance.
 
bool setMethod (const interp1Method m) noexcept
 Specify the interpolation method to use.
 
template<typename T >
real_t get (const T x) noexcept
 Interpolate input point x to determine the value of y at the points xi using the current method. If value is beyond the endpoints, extrapolation is performed using the current method.
 

Detailed Description

A 1D interpolation object.

Constructor & Destructor Documentation

◆ ~interp1()

virtual qlibs::interp1::~interp1 ( )
inlinevirtual

◆ interp1() [1/2]

qlibs::interp1::interp1 ( const real_t *const xTable,
const real_t *const yTable,
const size_t sizeTable )
inline

Constructor for the 1D interpolation instance.

Parameters
[in]xTableAn array of size sizeTable with the x points sorted in ascending order.
[in]yTableAn array of size sizeTable with the y points.
[in]sizeTableThe number of points in xTable yTable

◆ interp1() [2/2]

template<size_t sizeTable>
qlibs::interp1::interp1 ( real_t(&) xTable[sizeTable],
real_t(&) yTable[sizeTable] )
inline

Constructor for the 1D interpolation instance.

Parameters
[in]xTableAn array of size sizeTable with the x points sorted in ascending order.
[in]yTableAn array of size sizeTable with the y points.

Member Function Documentation

◆ get()

template<typename T >
real_t qlibs::interp1::get ( const T x)
inlinenoexcept

Interpolate input point x to determine the value of y at the points xi using the current method. If value is beyond the endpoints, extrapolation is performed using the current method.

Parameters
[in]xThe input point.
Returns
The interpolated-extrapolated y value.

◆ setData() [1/2]

bool qlibs::interp1::setData ( const real_t *const xTable,
const real_t *const yTable,
const size_t sizeTable )
inline

Set the data table for the 1D interpolation instance.

Parameters
[in]xTableAn array of size sizeTable with the x points sorted in ascending order.
[in]yTableAn array of size sizeTable with the y points.
[in]sizeTableThe number of points in xTable yTable

◆ setData() [2/2]

template<size_t sizeTable>
bool qlibs::interp1::setData ( real_t(&) xTable[sizeTable],
real_t(&) yTable[sizeTable] )
inline

Set the data for the 1D interpolation instance.

Parameters
[in]xTableAn array of size sizeTable with the x points sorted in ascending order.
[in]yTableAn array of size sizeTable with the y points.

◆ setMethod()

bool interp1::setMethod ( const interp1Method m)
noexcept

Specify the interpolation method to use.

Parameters
[in]mThe interpolation method.
Returns
true on success otherwise false.