Alexandria 2.31.2
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Euclid::MathUtils::LinearInterpolator Class Referencefinal
Inheritance diagram for Euclid::MathUtils::LinearInterpolator:
Collaboration diagram for Euclid::MathUtils::LinearInterpolator:

Public Member Functions

 LinearInterpolator (std::vector< double > knots, std::vector< double > coef0, std::vector< double > coef1)
 
virtual ~LinearInterpolator ()=default
 
double operator() (double x) const override
 
void operator() (const std::vector< double > &xs, std::vector< double > &out) const override
 
std::unique_ptr< NAryFunctionclone () const override
 
double integrate (const double a, const double b) const override
 
- Public Member Functions inherited from Euclid::MathUtils::PiecewiseBase
virtual ~PiecewiseBase ()=default
 
const std::vector< double > & getKnots () const
 Returns the knots of the piecewise function.
 
- Public Member Functions inherited from Euclid::MathUtils::Integrable
virtual ~Integrable ()=default
 Default destructor.
 

Private Member Functions

double antiderivative (int i, double x) const
 

Private Attributes

const std::vector< double > m_coef0
 
const std::vector< double > m_coef1
 

Additional Inherited Members

- Protected Member Functions inherited from Euclid::MathUtils::PiecewiseBase
 PiecewiseBase (std::vector< double > knots)
 
ssize_t findKnot (double x) const
 
- Protected Attributes inherited from Euclid::MathUtils::PiecewiseBase
std::vector< double > m_knots
 A vector where the knots are kept.
 

Detailed Description

Definition at line 33 of file linear.cpp.

Constructor & Destructor Documentation

◆ LinearInterpolator()

Euclid::MathUtils::LinearInterpolator::LinearInterpolator ( std::vector< double > knots,
std::vector< double > coef0,
std::vector< double > coef1 )
inline

Definition at line 35 of file linear.cpp.

References m_coef0, m_coef1, and Euclid::MathUtils::PiecewiseBase::PiecewiseBase().

Referenced by clone().

Here is the call graph for this function:

◆ ~LinearInterpolator()

virtual Euclid::MathUtils::LinearInterpolator::~LinearInterpolator ( )
virtualdefault

Member Function Documentation

◆ antiderivative()

double Euclid::MathUtils::LinearInterpolator::antiderivative ( int i,
double x ) const
inlineprivate

Definition at line 124 of file linear.cpp.

References m_coef0, and m_coef1.

Referenced by integrate().

◆ clone()

std::unique_ptr< NAryFunction > Euclid::MathUtils::LinearInterpolator::clone ( ) const
inlineoverridevirtual

Creates a clone of the function object. All subclasses must implement this method, to enable copying of Function objects when only a reference to the Function class is available.

Returns
A copy of the Function object

Implements Euclid::MathUtils::NAryFunction< 1 >.

Definition at line 84 of file linear.cpp.

References LinearInterpolator(), m_coef0, m_coef1, and Euclid::MathUtils::PiecewiseBase::m_knots.

Here is the call graph for this function:

◆ integrate()

double Euclid::MathUtils::LinearInterpolator::integrate ( const double a,
const double b ) const
inlineoverridevirtual

Calculates the integral of the function in the range [a,b].

Parameters
aThe lower bound of the integration
bThe upper bound of the integration
Returns
The integral of the function in the range [a,b]

Implements Euclid::MathUtils::Integrable.

Definition at line 88 of file linear.cpp.

References antiderivative(), Euclid::MathUtils::PiecewiseBase::m_knots, and std::upper_bound().

Here is the call graph for this function:

◆ operator()() [1/2]

void Euclid::MathUtils::LinearInterpolator::operator() ( const std::vector< double > & xs,
std::vector< double > & out ) const
inlineoverride

◆ operator()() [2/2]

double Euclid::MathUtils::LinearInterpolator::operator() ( double x) const
inlineoverride

Definition at line 40 of file linear.cpp.

References Euclid::MathUtils::PiecewiseBase::findKnot(), m_coef0, m_coef1, and Euclid::MathUtils::PiecewiseBase::m_knots.

Here is the call graph for this function:

Member Data Documentation

◆ m_coef0

const std::vector<double> Euclid::MathUtils::LinearInterpolator::m_coef0
private

Definition at line 122 of file linear.cpp.

Referenced by antiderivative(), clone(), LinearInterpolator(), operator()(), and operator()().

◆ m_coef1

const std::vector<double> Euclid::MathUtils::LinearInterpolator::m_coef1
private

Definition at line 122 of file linear.cpp.

Referenced by antiderivative(), clone(), LinearInterpolator(), operator()(), and operator()().


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