UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Typedefs | Functions
LeastSquares2D Namespace Reference

Classes

struct  PolyCoeff
 

Typedefs

typedef std::vector< PolyCoeffPolyCoeffs
 

Functions

bool getPoly (const vector< double > &x, const vector< double > &y, const vector< double > &w, PolyCoeffs &cfs)
 
bool getPoly (const vector< double > &x, const vector< double > &y, PolyCoeffs &cfs)
 
double calcPoly (const PolyCoeffs &coeffs, double x)
 
double ls_m_elem (size_t i, size_t j, const vector< double > &x, const vector< double > &w)
 
double ls_b_elem (size_t i, const vector< double > &x, const vector< double > &y, const vector< double > &w)
 

Detailed Description

Least squares. Functions return false if there is any error.

Typedef Documentation

typedef std::vector<PolyCoeff> LeastSquares2D::PolyCoeffs

Vector of coefficients

Function Documentation

double LeastSquares2D::calcPoly ( const PolyCoeffs &  coeffs,
double  x 
)

Calculates polynom with given coefficients for x.

bool LeastSquares2D::getPoly ( const vector< double > &  x,
const vector< double > &  y,
const vector< double > &  w,
PolyCoeffs &  cfs 
)

Calculates polynomial coefficients for provided nodes (x,y) and weights w. Vector of coefficients should be predefined by number of polynomial coefficients in the form of y = cfs[0] + cfs[1]*x + cfs[1]*x^2 + ... Sizes of x,y and w should be equal and <= than size of cfs. If any coefficients are fixed, its values will be preserved after calculation. Return false on error.

bool LeastSquares2D::getPoly ( const vector< double > &  x,
const vector< double > &  y,
PolyCoeffs &  cfs 
)

The same as above but without weights.