UFJF - Machine Learning Toolkit  0.51.8
mltk::Point< T, Rep > Class Template Reference

Wrapper for the point data. More...

#include <Point.hpp>

Public Types

using Matrix = typename mltk::Point< mltk::Point< T > >
 

Public Member Functions

auto begin () const
 
auto end () const
 
auto begin ()
 
auto end ()
 
 Point ()
 Empty constructor. More...
 
 Point (Point< T > const &p)
 
template<typename R1 >
 Point (Point< T, R1 > const &p)
 
template<typename T2 , typename R1 >
 Point (Point< T2, R1 > const &p)
 
 Point (std::size_t s)
 Construct a point with initial dimension. More...
 
 Point (std::size_t s, const T &value, const std::size_t &id=0)
 Construct a point with initial dimension, default value and id. More...
 
 Point (Rep const &rb)
 Construct a point with a custom internal representation. More...
 
 Point (std::initializer_list< T > init)
 
std::size_t size () const
 Returns the dimension of the point. More...
 
Rep const & X () const
 Returns the attributes representation of the point (std::vector by default). More...
 
Rep & X ()
 Returns a reference to the attributes representation of the point (std::vector by default). More...
 
double const & Y () const
 Returns the class or value of the point. More...
 
double & Y ()
 Returns a reference to the class or value of the point. More...
 
double const & Alpha () const
 Return the alpha value of the point. More...
 
double & Alpha ()
 Returns a reference to the alpha value of the point. More...
 
size_t const & Id () const
 Returns the id of the point. More...
 
size_t & Id ()
 Returns a reference to the id of the point. More...
 
void setY (double const &_y)
 Set the class or value of the point. More...
 
void setAlpha (double const &_alpha)
 Set alpha value of the point. More...
 
void setID (size_t const &_id)
 Set the id of the point. More...
 
Point< T > selectFeatures (std::vector< size_t > feats) const
 
template<typename Iter >
Iter erase (Iter b, Iter e)
 
bool empty () const
 
decltype(auto) operator[] (const size_t &idx) const
 
T & operator[] (const size_t &idx)
 
template<typename T2 , typename R2 >
Point< T, A_Subscript< T, Rep, R2 > > operator[] (Point< T2, R2 > const &b)
 
template<typename... Types>
void resize (Types... args)
 
template<typename... Types>
void assign (Types... args)
 
void clear ()
 
double norm (int p=NormType::NORM_L2) const
 Returns the p-norm of the point. More...
 
sum (const std::function< T(T)> &f=[](T const &t) { return t;}) const
 Compute the sum of the components of the point. More...
 
Pointoperator= (Point const &b)
 
template<typename T2 , typename Rep2 >
Pointoperator= (Point< T2, Rep2 > const &b)
 
Pointoperator= (std::vector< T > const &b)
 
template<typename T2 >
Pointoperator= (std::vector< T2 > const &b)
 
Pointoperator= (T const &b)
 
template<typename Y >
Pointoperator= (Y const &b)
 
Pointoperator+= (Point const &b)
 
Pointoperator+= (T const &b)
 
template<typename Y >
Pointoperator+= (Y const &b)
 
template<typename T2 , typename Rep2 >
Pointoperator+= (Point< T2, Rep2 > const &b)
 
Pointoperator-= (Point const &b)
 
template<typename T2 , typename Rep2 >
Pointoperator-= (Point< T2, Rep2 > const &b)
 
Pointoperator-= (T const &b)
 
template<typename Y >
Pointoperator-= (Y const &b)
 
Pointoperator*= (Point const &b)
 
template<typename T2 , typename Rep2 >
Pointoperator*= (Point< T2, Rep2 > const &b)
 
Pointoperator*= (T const &b)
 
template<typename Y >
Pointoperator*= (Y const &b)
 
Pointoperator/= (Point const &b)
 
template<typename T2 , typename Rep2 >
Pointoperator/= (Point< T2, Rep2 > const &b)
 
Pointoperator/= (T const &b)
 
template<typename Y >
Pointoperator/= (Y const &b)
 
bool operator== (Point const &rhs) const
 
bool operator!= (Point const &rhs) const
 

Friends

std::ostream & operator (std::ostream &output, const Point< T, Rep > &p)
 

Detailed Description

template<typename T = double, typename Rep = std::vector<T>>
class mltk::Point< T, Rep >

Wrapper for the point data.

Constructor & Destructor Documentation

◆ Point() [1/4]

template<typename T = double, typename Rep = std::vector<T>>
mltk::Point< T, Rep >::Point ( )
inline

Empty constructor.

◆ Point() [2/4]

template<typename T = double, typename Rep = std::vector<T>>
mltk::Point< T, Rep >::Point ( std::size_t  s)
inlineexplicit

Construct a point with initial dimension.

Parameters
sDimension of the point.

◆ Point() [3/4]

template<typename T = double, typename Rep = std::vector<T>>
mltk::Point< T, Rep >::Point ( std::size_t  s,
const T &  value,
const std::size_t &  id = 0 
)
inline

Construct a point with initial dimension, default value and id.

Parameters
sDimension of the point.
valueInitial value of the dimensions.
idId of the point

◆ Point() [4/4]

template<typename T = double, typename Rep = std::vector<T>>
mltk::Point< T, Rep >::Point ( Rep const &  rb)
inline

Construct a point with a custom internal representation.

Parameters
rbPoint internal representation (std::vector by default).

Member Function Documentation

◆ Alpha() [1/2]

template<typename T = double, typename Rep = std::vector<T>>
double& mltk::Point< T, Rep >::Alpha ( )
inline

Returns a reference to the alpha value of the point.

Returns
double

◆ Alpha() [2/2]

template<typename T = double, typename Rep = std::vector<T>>
double const& mltk::Point< T, Rep >::Alpha ( ) const
inline

Return the alpha value of the point.

Returns
double

◆ Id() [1/2]

template<typename T = double, typename Rep = std::vector<T>>
size_t& mltk::Point< T, Rep >::Id ( )
inline

Returns a reference to the id of the point.

Returns
size_t

◆ Id() [2/2]

template<typename T = double, typename Rep = std::vector<T>>
size_t const& mltk::Point< T, Rep >::Id ( ) const
inline

Returns the id of the point.

Returns
size_t

◆ norm()

template<typename T , typename Rep >
double mltk::Point< T, Rep >::norm ( int  p = NormType::NORM_L2) const

Returns the p-norm of the point.

Parameters
pp of the norm (euclidean norm is the default).
Returns
double

◆ setAlpha()

template<typename T = double, typename Rep = std::vector<T>>
void mltk::Point< T, Rep >::setAlpha ( double const &  _alpha)
inline

Set alpha value of the point.

Parameters
alphaalpha value.

◆ setID()

template<typename T = double, typename Rep = std::vector<T>>
void mltk::Point< T, Rep >::setID ( size_t const &  _id)
inline

Set the id of the point.

Parameters
_idnew id of the point.

◆ setY()

template<typename T = double, typename Rep = std::vector<T>>
void mltk::Point< T, Rep >::setY ( double const &  _y)
inline

Set the class or value of the point.

Parameters
yThe class/value of the point.

◆ size()

template<typename T = double, typename Rep = std::vector<T>>
std::size_t mltk::Point< T, Rep >::size ( ) const
inline

Returns the dimension of the point.

Returns
std::size_t

◆ sum()

template<typename T = double, typename Rep = std::vector<T>>
T mltk::Point< T, Rep >::sum ( const std::function< T(T)> &  f = [](T const& t) { return t;}) const
inline

Compute the sum of the components of the point.

Returns
The sum of the components of the point.

◆ X() [1/2]

template<typename T = double, typename Rep = std::vector<T>>
Rep& mltk::Point< T, Rep >::X ( )
inline

Returns a reference to the attributes representation of the point (std::vector by default).

◆ X() [2/2]

template<typename T = double, typename Rep = std::vector<T>>
Rep const& mltk::Point< T, Rep >::X ( ) const
inline

Returns the attributes representation of the point (std::vector by default).

◆ Y() [1/2]

template<typename T = double, typename Rep = std::vector<T>>
double& mltk::Point< T, Rep >::Y ( )
inline

Returns a reference to the class or value of the point.

Returns
double

◆ Y() [2/2]

template<typename T = double, typename Rep = std::vector<T>>
double const& mltk::Point< T, Rep >::Y ( ) const
inline

Returns the class or value of the point.

Returns
double

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