UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
least_squares_2d.hpp
1 // $Id: least_squares_2d.hpp,v 1.2 2009/08/03 15:58:36 urij Exp $
2 
3 #ifndef __least_squares_2d_hpp
4 #define __least_squares_2d_hpp
5 
6 #include <vector>
7 #include <cstring>
8 
10 namespace LeastSquares2D
11 {
12  using std::vector;
13 
15  struct PolyCoeff
16  {
17  PolyCoeff() : c(0.), fixed(false) {};
18  PolyCoeff(double i_c, bool i_fixed = false) {c = i_c; fixed = i_fixed;}
19 
20  double c;
21  bool fixed;
22  };
23 
25  typedef std::vector<PolyCoeff> PolyCoeffs;
26 
32  bool getPoly(const vector<double> &x,
33  const vector<double> &y,
34  const vector<double> &w,
35  PolyCoeffs &cfs);
36 
38  bool getPoly(const vector<double> &x,
39  const vector<double> &y,
40  PolyCoeffs &cfs);
41 
43  double calcPoly(const PolyCoeffs &coeffs, double x);
44 
45  double ls_m_elem(size_t i, size_t j, const vector<double> &x, const vector<double> &w);
46 
47  double ls_b_elem(size_t i, const vector<double> &x, const vector<double> &y, const vector<double> &w);
48 };
49 
50 #endif //__least_squares_2d_hpp
bool getPoly(const vector< double > &x, const vector< double > &y, const vector< double > &w, PolyCoeffs &cfs)
bool fixed
Definition: least_squares_2d.hpp:21
Definition: least_squares_2d.hpp:15
double c
Definition: least_squares_2d.hpp:20
std::vector< PolyCoeff > PolyCoeffs
Definition: least_squares_2d.hpp:25
double calcPoly(const PolyCoeffs &coeffs, double x)