regression.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_REGRESSION_HPP
2 #define JULIAN_REGRESSION_HPP
3 
4 #include <vector>
5 
6 namespace julian {
7 
20  class Regression {
21  public:
26 
30  virtual void estimate(const std::vector<double>& x,const std::vector<double>& y) = 0;
31 
36  virtual std::vector<double> getCoefficient() const = 0;
37 
43  virtual double operator()(double) const = 0;
44 
47  virtual Regression* clone() const = 0;
48 
51  virtual ~Regression(){};
52  };
53 
59  template<typename T>
61  public:
64  virtual Regression* clone() const {
65  return new T(static_cast<const T&>(*this));
66  }
67  };
68 
69 } // namespace julian
70 #endif
virtual double operator()(double) const =0
Operator performing calculation.
Definition: cadHoliday.cpp:3
virtual void estimate(const std::vector< double > &x, const std::vector< double > &y)=0
Estimates regression coefficients.
virtual Regression * clone() const =0
Virtual copy constructor.
virtual std::vector< double > getCoefficient() const =0
return coefficients of the regression
Regression()
Constructor.
Definition: regression.hpp:25
virtual ~Regression()
Destructor.
Definition: regression.hpp:51
virtual Regression * clone() const
virtual copy constructor
Definition: regression.hpp:64
Class is an abstract class implementing interface of regression.
Definition: regression.hpp:20
Class uses Curiously Recurring Template Pattern to implement polymorphic copy construction in every d...
Definition: regression.hpp:60