Helios++
Helios software for LiDAR simulations
fluxionum::LinearPiecesFunction< A, B > Class Template Reference

Linear pieces function. More...

#include <LinearPiecesFunction.h>

Inheritance diagram for fluxionum::LinearPiecesFunction< A, B >:
Collaboration diagram for fluxionum::LinearPiecesFunction< A, B >:

Public Member Functions

 LinearPiecesFunction (Col< A > const &start, Col< B > const &slope, Col< B > const &intercept)
 LinearPiecesFunction default constructor. More...
 
eval (A const &x) override
 Calculate the image of \(x\) by \(f\) assuming a linear behavior where \(a_i\) is the slope and \(b_i\) is the intercept. More...
 
getStart (size_t const i=0) const
 Obtain the \(i\)-th start point \(s_i\) of the linear function. More...
 
getSlope (size_t const i=0) const
 Obtain the \(i\)-th slope \(a_i\) of the linear function. More...
 
getIntercept (size_t const i=0) const
 Obtain the \(i\)-th intercept \(b_i\) of the linear function. More...
 
size_t findIndex (A const &x) const
 Obtain the index identifying the interval where \(x\) belongs to. It is, find \(i\) such that \(x \in [s_{i}, s_{i+1})\). More...
 
- Public Member Functions inherited from fluxionum::Function< A, B >
 Function ()=default
 
operator() (A const &x)
 Evaluate the function \(f(x)=y\). More...
 

Static Public Member Functions

static size_t findIndex (A const &x, arma::Col< A > const &start)
 Assist the LinearPiecesFunction::findIndex(A const &) More...
 

Protected Attributes

arma::Col< A > const & start
 The set \(S\) of \(m\) sorted start points. More...
 
arma::Col< B > const & slope
 The slopes for each piece \(a_1, \ldots, a_m\).
 
arma::Col< B > const & intercept
 The intercepts for each piece \(b_1, \ldots, b_m\).
 

Detailed Description

template<typename A, typename B>
class fluxionum::LinearPiecesFunction< A, B >

Linear pieces function.

Author
Alberto M. Esmoris Pena
Version
1.0

\[ f(x) = a_{i}(x-s_i) + b_{i} \]

There is a sorted set of \(m\) interval boundaries \(S=\{s_1, \ldots, s_m\} \subset A\). Thus, the index \(i\) to determine the slope \(a_i\) and the intercept \(b_i\) can be obtained as \(x \in [s_i, s_{i+1})\) for the general case. For the particular case of \(i=m\) it is \(x \in [s_{m}, \infty)\)

See also
fluxionum::Function

Constructor & Destructor Documentation

◆ LinearPiecesFunction()

template<typename A , typename B >
fluxionum::LinearPiecesFunction< A, B >::LinearPiecesFunction ( Col< A > const &  start,
Col< B > const &  slope,
Col< B > const &  intercept 
)
inline

Member Function Documentation

◆ eval()

template<typename A , typename B >
B fluxionum::LinearPiecesFunction< A, B >::eval ( A const &  x)
inlineoverridevirtual

Calculate the image of \(x\) by \(f\) assuming a linear behavior where \(a_i\) is the slope and \(b_i\) is the intercept.

\[ f(x) = a_i x + b_i \]

Parameters
xThe input value belonging to the domain of the function
Returns
The image of \(x\) by \(f\)

Implements fluxionum::Function< A, B >.

◆ findIndex() [1/2]

template<typename A , typename B >
size_t fluxionum::LinearPiecesFunction< A, B >::findIndex ( A const &  x) const
inline

Obtain the index identifying the interval where \(x\) belongs to. It is, find \(i\) such that \(x \in [s_{i}, s_{i+1})\).

Parameters
xThe input value belonging to the domain of the function
Returns
The index identifying the interval where \(x\) belongs to
See also
LinearPiecesFunction::findIndex(A const &, arma::Col<A> const &)

◆ findIndex() [2/2]

template<typename A , typename B >
static size_t fluxionum::LinearPiecesFunction< A, B >::findIndex ( A const &  x,
arma::Col< A > const &  start 
)
inlinestatic

Assist the LinearPiecesFunction::findIndex(A const &)

See also
fluxionum::LinearPiecesFunction::findIndex(A const &)

◆ getIntercept()

template<typename A , typename B >
B fluxionum::LinearPiecesFunction< A, B >::getIntercept ( size_t const  i = 0) const
inline

Obtain the \(i\)-th intercept \(b_i\) of the linear function.

Parameters
iIndex of the intercept to be obtained. In case there are no multiple intercepts, the default value \(i=0\) must be used.
Returns
The \(i\)-th intercept \(b_i\) of the linear function

◆ getSlope()

template<typename A , typename B >
B fluxionum::LinearPiecesFunction< A, B >::getSlope ( size_t const  i = 0) const
inline

Obtain the \(i\)-th slope \(a_i\) of the linear function.

Parameters
iIndex of the slope to be obtained. In case there are no multiple slopes, the default value \(i=0\) must be used.
Returns
The \(i\)-th slope \(a_i\) of the linear function

◆ getStart()

template<typename A , typename B >
A fluxionum::LinearPiecesFunction< A, B >::getStart ( size_t const  i = 0) const
inline

Obtain the \(i\)-th start point \(s_i\) of the linear function.

Parameters
iIndex of the start point to be obtained,
Returns
The \(i\)-th start point of the linear function

Member Data Documentation

◆ start

template<typename A , typename B >
arma::Col<A> const& fluxionum::LinearPiecesFunction< A, B >::start
protected

The set \(S\) of \(m\) sorted start points.

See also
fluxionum::ParametricLinearPiecesFunction::start

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