source: trunk/lib/statistics/Polynomial.h @ 383

Last change on this file since 383 was 383, checked in by Jari Häkkinen, 16 years ago

Moved regression stuff into a namespace ...statistics::regression.
Filenames was changed and a first draft of a Polynomial regression is
implemented (compiles but does not run properly).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1// $Id: Polynomial.h 383 2005-08-12 15:39:24Z jari $
2
3#ifndef _theplu_statistics_regression_polynomial_
4#define _theplu_statistics_regression_polynomial_
5
6#include <c++_tools/statistics/OneDimensional.h>
7
8#include <c++_tools/gslapi/matrix.h>
9#include <c++_tools/gslapi/vector.h>
10
11#include <gsl/gsl_multifit.h>
12
13
14namespace theplu {
15namespace statistics {
16namespace regression {
17
18  ///
19  ///
20  ///
21  class Polynomial : public OneDimensional
22  {
23  public:
24
25    ///
26    ///
27    ///
28    Polynomial(gslapi::matrix&,size_t);
29
30    ///
31    /// @brief Destructor
32    ///
33    ~Polynomial(void);
34
35    ///
36    ///
37    ///
38    int fit(void)
39      { return gsl_multifit_linear(X_.gsl_matrix_pointer(),
40                                   target_.TEMP_gsl_vector_pointer(),
41                                   fit_parameters_.TEMP_gsl_vector_pointer(),
42                                   covariance_.gsl_matrix_pointer(),
43                                   &chisquare_,work_); }
44
45    ///
46    ///
47    ///
48    gslapi::vector fit_parameters(void) { return fit_parameters_; }
49
50
51  private:
52    double chisquare_;
53    gslapi::matrix covariance_;
54    gslapi::vector fit_parameters_;
55    gslapi::vector target_;
56    gsl_multifit_linear_workspace* work_;
57    gslapi::matrix X_;    // matrix of predictor variables in GSL language
58
59  };
60
61
62}}} // of namespaces regression, statisitcs and thep
63
64#endif
Note: See TracBrowser for help on using the repository browser.