From 70a767c1a81de38d019b804cfcfd3b8255868723 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Sat, 19 Feb 2011 13:12:59 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@178 ed2142bd-67ad-457f-ba7c-d818d4011675 --- pre_estimaters/lin1d_estimater.hpp | 2 +- pre_estimaters/vlin1d_estimater.hpp | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 pre_estimaters/vlin1d_estimater.hpp diff --git a/pre_estimaters/lin1d_estimater.hpp b/pre_estimaters/lin1d_estimater.hpp index 0a76df3..83e6312 100644 --- a/pre_estimaters/lin1d_estimater.hpp +++ b/pre_estimaters/lin1d_estimater.hpp @@ -1,6 +1,6 @@ #ifndef LIN1D_ESTIMATER #define LIN1D_ESTIMATER -#include "pre_estimater.hpp" +#include #include #include #include diff --git a/pre_estimaters/vlin1d_estimater.hpp b/pre_estimaters/vlin1d_estimater.hpp new file mode 100644 index 0000000..7f37b3c --- /dev/null +++ b/pre_estimaters/vlin1d_estimater.hpp @@ -0,0 +1,52 @@ +#ifndef VLIN1D_ESTIMATER +#define VLIN1D_ESTIMATER +#include +#include +#include +#include + +namespace opt_utilities +{ + template + class lin1d_estimater + :public pre_estimater,optvec,optvec,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,optvec >& d,model,optvec,optvec,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