From 784f745b792b45d1cce283fac3d5b0fcc6946adf Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Sat, 19 Feb 2011 01:46:03 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@177 ed2142bd-67ad-457f-ba7c-d818d4011675 --- pre_estimaters/lin1d_estimater.hpp | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pre_estimaters/lin1d_estimater.hpp (limited to 'pre_estimaters') diff --git a/pre_estimaters/lin1d_estimater.hpp b/pre_estimaters/lin1d_estimater.hpp new file mode 100644 index 0000000..0a76df3 --- /dev/null +++ b/pre_estimaters/lin1d_estimater.hpp @@ -0,0 +1,52 @@ +#ifndef LIN1D_ESTIMATER +#define LIN1D_ESTIMATER +#include "pre_estimater.hpp" +#include +#include +#include + +namespace opt_utilities +{ + template + class lin1d_estimater + :public pre_estimater,std::string> + { + public: + lin1d_estimater() + { + this->set_model_id("1d linear model"); + } + + lin1d_estimater* do_clone()const + { + return new lin1d_estimater(*this); + } + + void do_estimate(const data_set& d,model,std::string>& m)const + { + T n=d.size(); + T sy=0; + T sxx=0; + T sx=0; + T sxy=0; + + for(int i=0;i