Helios++
Helios software for LiDAR simulations
|
Linear pieces function. More...
#include <LinearPiecesFunction.h>
Public Member Functions | |
LinearPiecesFunction (Col< A > const &start, Col< B > const &slope, Col< B > const &intercept) | |
LinearPiecesFunction default constructor. More... | |
B | 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... | |
A | getStart (size_t const i=0) const |
Obtain the \(i\)-th start point \(s_i\) of the linear function. More... | |
B | getSlope (size_t const i=0) const |
Obtain the \(i\)-th slope \(a_i\) of the linear function. More... | |
B | 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... | |
![]() | |
Function ()=default | |
B | 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\). | |
Linear pieces function.
\[ 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)\)
|
inline |
|
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 \]
x | The input value belonging to the domain of the function |
Implements fluxionum::Function< A, B >.
|
inline |
Obtain the index identifying the interval where \(x\) belongs to. It is, find \(i\) such that \(x \in [s_{i}, s_{i+1})\).
x | The input value belonging to the domain of the function |
|
inlinestatic |
Assist the LinearPiecesFunction::findIndex(A const &)
|
inline |
Obtain the \(i\)-th intercept \(b_i\) of the linear function.
i | Index of the intercept to be obtained. In case there are no multiple intercepts, the default value \(i=0\) must be used. |
|
inline |
Obtain the \(i\)-th slope \(a_i\) of the linear function.
i | Index of the slope to be obtained. In case there are no multiple slopes, the default value \(i=0\) must be used. |
|
inline |
Obtain the \(i\)-th start point \(s_i\) of the linear function.
i | Index of the start point to be obtained, |
|
protected |
The set \(S\) of \(m\) sorted start points.