00001
00002
00003 #ifndef JMATH_LINEAR_LEAST_SQUARES2_HPP
00004 #define JMATH_LINEAR_LEAST_SQUARES2_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 {
00015
00027 class VariableSizeLinearLeastSquares2 {
00028
00029 private:
00031 std::size_t m_modelSize;
00033 std::size_t m_dataSetSize;
00035 std::size_t m_countValues;
00037 jblas::mat_column_major m_A;
00039 jblas::vec m_b;
00041 jblas::vec m_x;
00043 jblas::sym_mat m_xCov;
00044
00045 public:
00046
00047 VariableSizeLinearLeastSquares2(size_t _modelSize);
00048 VariableSizeLinearLeastSquares2(size_t _modelSize, size_t _dataSetSize);
00049 inline std::size_t modelSize() const { return m_modelSize; }
00050 inline std::size_t dataSetSize() const { return m_dataSetSize; }
00051
00052 inline jblas::mat_column_major const& A() const {return m_A;}
00053 inline jblas::mat_column_major& A() {return m_A;}
00054
00055 inline jblas::vec const& b() const {return m_b;}
00056 inline jblas::vec& b() {return m_b;}
00057
00058 inline jblas::vec const& x() const {return m_x;}
00059 inline jblas::sym_mat const& xCov() const {return m_xCov;}
00060
00061 void setSize(std::size_t sizeModel, std::size_t sizeDataSet);
00062 void setDataSetSize(std::size_t sizeDataSet);
00063
00067 void addMeasure(jblas::vec const& A_row, double b_val);
00068
00069 void solve();
00071 int countMeasures() const { return m_countValues; }
00078 void merge( const VariableSizeLinearLeastSquares2& );
00079 };
00080
00081 }
00082 }
00083
00084
00085 #endif // HAVE_LAPACK
00086 #endif // HAVE_BOOST_SANDBOX
00087
00088 #endif // JMATH_LINEAR_LEAST_SQUARES_HPP