12#include <include/qlibs_types.hpp>
49 const size_t tableSize );
50 const real_t *xData{
nullptr };
51 const real_t *yData{
nullptr };
52 size_t dataSize{ 0U };
53 interp1Fcn_t method{ &linear };
61 static real_t leftSecondDerivate(
const real_t *
const tx,
65 static real_t rightSecondDerivate(
const real_t *
const tx,
72 const size_t tableSize );
76 const size_t tableSize );
80 const size_t tableSize );
84 const size_t tableSize );
88 const size_t tableSize );
92 const size_t tableSize );
96 const size_t tableSize );
100 const size_t tableSize );
104 const size_t tableSize );
114 const real_t *
const yTable,
115 const size_t sizeTable ) : xData( xTable ), yData( yTable ), dataSize( sizeTable ) {}
122 template <
size_t sizeTable>
124 real_t (&yTable)[ sizeTable ] ) :
interp1( xTable, yTable, sizeTable ) {}
133 const real_t *
const yTable,
134 const size_t sizeTable )
136 bool retValue =
false;
138 if ( (
nullptr != xTable ) && (
nullptr != yTable ) && ( sizeTable >= 4U ) ) {
141 dataSize = sizeTable;
152 template <
size_t sizeTable>
154 real_t (&yTable)[ sizeTable ] )
156 return setData( xTable, yTable, sizeTable );
165 template <
typename T>
176 return method(
static_cast<real_t>( x ), xData, yData, dataSize );
A 1D interpolation object.
Definition interp1.hpp:44
interp1(real_t(&xTable)[sizeTable], real_t(&yTable)[sizeTable])
Constructor for the 1D interpolation instance.
Definition interp1.hpp:123
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....
Definition interp1.hpp:174
bool setData(real_t(&xTable)[sizeTable], real_t(&yTable)[sizeTable])
Set the data for the 1D interpolation instance.
Definition interp1.hpp:153
bool setMethod(const interp1Method m) noexcept
Specify the interpolation method to use.
Definition interp1.cpp:8
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.
Definition interp1.hpp:132
virtual ~interp1()
Definition interp1.hpp:106
interp1(const real_t *const xTable, const real_t *const yTable, const size_t sizeTable)
Constructor for the 1D interpolation instance.
Definition interp1.hpp:113
interp1Method
An enum with all the available interpolation methods.
Definition interp1.hpp:26
@ INTERP1_CUBIC
Definition interp1.hpp:32
@ INTERP1_LINEAR
Definition interp1.hpp:30
@ INTERP1_PREVIOUS
Definition interp1.hpp:28
@ INTERP1_NEAREST
Definition interp1.hpp:29
@ INTERP1_NEXT
Definition interp1.hpp:27
@ INTERP1_SPLINE
Definition interp1.hpp:34
@ INTERP1_SINE
Definition interp1.hpp:31
@ INTERP1_CONSTRAINED_SPLINE
Definition interp1.hpp:35
@ INTERP1_HERMITE
Definition interp1.hpp:33
The qLibs++ library namespace.
Definition fp16.cpp:4
float real_t
A type to instantiate a real variable double-precision of 64-bits IEEE 754.
Definition qlibs_types.hpp:43