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

Closest lesser sample function. More...

#include <ClosestLesserSampleFunction.h>

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

Public Member Functions

 ClosestLesserSampleFunction (arma::Col< A > const &t, arma::Col< B > const &y, size_t const i=0)
 ClosestLesserSampleFunction default constructor. More...
 
ClosestLesserSampleFunction< A, B > & operator= (ClosestLesserSampleFunction< A, B > const &clsf)
 Assignment reference operator.
 
eval (A const &tx) override
 Find the sample with closest lesser domain with respect to given \(t\) and return its known image \(y_i\). More...
 
virtual void restart ()
 Restart the ClosestLesserSampleFunction so it is at its initial state again (it is, at the first sample)
 
arma::Col< A > const & getT () const
 
arma::Col< B > const & getY () const
 
size_t getCurrentSampleIndex () const
 
void setCurrentSampleIndex (size_t const i)
 
- Public Member Functions inherited from fluxionum::Function< A, B >
 Function ()=default
 
operator() (A const &x)
 Evaluate the function \(f(x)=y\). More...
 

Protected Attributes

arma::Col< A > const & t
 The vector of sorted domain components \(\vec{t} = (t_1, \ldots, t_m)\).
 
arma::Col< B > const & y
 The vector of sorted image components \(\vec{y} = (y_1, \ldots, y_m)\) such that \(\forall i,\, y(t_{i}) = y_i\).
 
size_t i
 The index of the current sorted domain sample.
 

Detailed Description

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

Closest lesser sample function.

Author
Alberto M. Esmoris Pena
Version
1.0

The ClosestLesserSampleFunction must have a vector of sorted domain components such that \(\forall i,\, t_{i+1} > t_{i}\). Also, for each \(t_i\) there must exist a known \(y_i\) such that \(y(t_{i}) = y_i\).

For the sake of efficiency, the ClosestLesserSampleFunction assumes that the value of \(t\) is going to be queried in an unidirectional forward sense. When querying values in a backward sense, result integrity is guaranteed but it might be at the expenses of performance.

See also
fluxionum::Function

Constructor & Destructor Documentation

◆ ClosestLesserSampleFunction()

template<typename A , typename B >
fluxionum::ClosestLesserSampleFunction< A, B >::ClosestLesserSampleFunction ( arma::Col< A > const &  t,
arma::Col< B > const &  y,
size_t const  i = 0 
)
inline

ClosestLesserSampleFunction default constructor.

Parameters
iThe index of the initial domain sample. By default, it is assumed to be 0, it is the first domain sample.
See also
fluxionum::ClosestLesserSampleFunction::t
fluxionum::ClosestLesserSampleFunction::y
fluxionum::ClosestLesserSampleFunction::i

Member Function Documentation

◆ eval()

template<typename A , typename B >
B fluxionum::ClosestLesserSampleFunction< A, B >::eval ( A const &  tx)
inlineoverridevirtual

Find the sample with closest lesser domain with respect to given \(t\) and return its known image \(y_i\).

Parameters
txThe domain value which closest lesser sample must be found
Returns
\(y_i\), it is the known image of the closest lesser sample

Implements fluxionum::Function< A, B >.

◆ getCurrentSampleIndex()

template<typename A , typename B >
size_t fluxionum::ClosestLesserSampleFunction< A, B >::getCurrentSampleIndex ( ) const
inline

◆ getT()

template<typename A , typename B >
arma::Col<A> const& fluxionum::ClosestLesserSampleFunction< A, B >::getT ( ) const
inline

◆ getY()

template<typename A , typename B >
arma::Col<B> const& fluxionum::ClosestLesserSampleFunction< A, B >::getY ( ) const
inline

◆ setCurrentSampleIndex()

template<typename A , typename B >
void fluxionum::ClosestLesserSampleFunction< A, B >::setCurrentSampleIndex ( size_t const  i)
inline

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