From 33e278850572786452388070cf7a3d745be25892 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Wed, 16 Feb 2011 17:40:00 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@176 ed2142bd-67ad-457f-ba7c-d818d4011675 --- pre_estimater/lin1d_estimater.hpp | 26 +++++++++++++++++++++++--- pre_estimater/pre_estimater.hpp | 23 ++++++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/pre_estimater/lin1d_estimater.hpp b/pre_estimater/lin1d_estimater.hpp index e36f2a7..0a76df3 100644 --- a/pre_estimater/lin1d_estimater.hpp +++ b/pre_estimater/lin1d_estimater.hpp @@ -11,18 +11,38 @@ namespace opt_utilities class lin1d_estimater :public pre_estimater,std::string> { - private: + public: lin1d_estimater() { + this->set_model_id("1d linear model"); } - lin1d_estimater do_clone()const + lin1d_estimater* do_clone()const { return new lin1d_estimater(*this); } - void do_estimate(const data& d,model,std::string>& m)const + 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& rhs) + { + if(rhs.ppe) + { + ppe=rhs.ppe->clone(); + } + } + + pre_estimatable& operator=(const pre_estimatable& rhs) + { + if(this==&rhs) + { + return *this; + } + if(ppe) + { + ppe->destroy(); + } + ppe=rhs.ppe->clone(); + } void set_pre_estimater(const pre_estimater& pe) { @@ -74,7 +95,7 @@ namespace opt_utilities { if(ppe) { - delete ppe; + ppe->destroy(); } } -- cgit v1.2.2