00001
00002
00003 #ifndef _JMATH_VARIABLESIZELINEARLEASTSQUARES_HPP_
00004 #define _JMATH_VARIABLESIZELINEARLEASTSQUARES_HPP_
00005
00006 #include "jafarConfig.h"
00007
00008 #ifdef HAVE_BOOST_SANDBOX
00009 #ifdef HAVE_LAPACK
00010
00011 #include "jmath/jblas.hpp"
00012
00013 namespace jafar {
00014 namespace jmath {
00025 class VariableSizeLinearLeastSquares {
00026 public:
00027 explicit VariableSizeLinearLeastSquares(int _modelSize);
00028 const jblas::vec& x() const {return m_x;}
00029 void solve();
00030 void addMeasure( const jblas::vec& dataPoint, double b_val);
00031 jblas::sym_mat A() { return m_A; }
00032 double computeMinimum() const;
00033 int countMeasures() const { return m_countValues; }
00040 void merge( const VariableSizeLinearLeastSquares& );
00041 private:
00043 int m_modelSize;
00044
00046 jblas::sym_mat m_A;
00047
00048
00050 ublas::matrix<double, ublas::column_major> m_b;
00051
00053 jblas::vec m_x;
00054
00055 double m_b_val;
00056 int m_countValues;
00057 };
00058 }
00059 }
00060
00061 #endif
00062 #endif
00063
00064 #endif