Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::LinearLeastSquares Class Reference

Computes the linear least squares regression of a function evaluated in 3d. More...

#include <exploragram/optimal_transport/linear_least_squares.h>

Public Member Functions

 LinearLeastSquares (index_t degree)
 Constructs a new LinearLeastSquares. More...
 
void begin ()
 Starts a new computation.
 
void end ()
 Ends the current computation. More...
 
void add_point (const double *p, double v)
 Adds a sample to the current computation. More...
 
double eval (const double *p) const
 Evaluates the least-squares linear estimate at a given point. More...
 

Protected Member Functions

void add_point_degree_1 (const double *p, double v)
 Implementation of add_point() for degree 1. More...
 
void add_point_degree_2 (const double *p, double v)
 Implementation of add_point() for degree 2. More...
 
index_t dim () const
 Gets the dimension of the function basis.
 
void eval_basis (const double *p, double *b) const
 Evaluates the function basis at a given point. More...
 

Static Protected Attributes

static const int MAX_DIM = 10
 Maximum dimension of the function basis.
 

Detailed Description

Computes the linear least squares regression of a function evaluated in 3d.

\TODO: have a linear solve function that does not require a template argument...

Definition at line 63 of file linear_least_squares.h.

Constructor & Destructor Documentation

◆ LinearLeastSquares()

GEO::LinearLeastSquares::LinearLeastSquares ( index_t  degree)

Constructs a new LinearLeastSquares.

Parameters
[in]degreeone of 1 (linear), 2 (quadratic)

Member Function Documentation

◆ add_point()

void GEO::LinearLeastSquares::add_point ( const double *  p,
double  v 
)

Adds a sample to the current computation.

This function needs to be called between a begin() / end() pair.

Parameters
[in]p3d coordinates of the point
[in]vfunction value associated with p_in

◆ add_point_degree_1()

void GEO::LinearLeastSquares::add_point_degree_1 ( const double *  p,
double  v 
)
protected

Implementation of add_point() for degree 1.

Parameters
[in]p3d coordinates of the point
[in]vfunction value associated with p_in

◆ add_point_degree_2()

void GEO::LinearLeastSquares::add_point_degree_2 ( const double *  p,
double  v 
)
protected

Implementation of add_point() for degree 2.

Parameters
[in]p3d coordinates of the point
[in]vfunction value associated with p_in

◆ end()

void GEO::LinearLeastSquares::end ( )

Ends the current computation.

Computes the current equation from the set of samples declared with add_point().

◆ eval()

double GEO::LinearLeastSquares::eval ( const double *  p) const

Evaluates the least-squares linear estimate at a given point.

This function beeds to be called after end().

Parameters
[in]p3d coordinates of the point
Returns
the linear estimate at p

◆ eval_basis()

void GEO::LinearLeastSquares::eval_basis ( const double *  p,
double *  b 
) const
protected

Evaluates the function basis at a given point.

Parameters
[in]p3d coordinates of the point
[out]barray of size dim(), value of the function basis at p

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