From 940839ecd20a5c194ce6076240f04b0e98cd8fde Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Thu, 2 Apr 2009 12:28:41 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@12 ed2142bd-67ad-457f-ba7c-d818d4011675 --- core/default_data_set.hpp | 2 +- core/fitter.hpp | 36 +++++++++++++++++++----------------- core/freeze_param.hpp | 4 ++-- interface/opt.cc | 2 +- misc/bootstrap.hpp | 2 +- samples/a.dat | 8 ++++---- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/core/default_data_set.hpp b/core/default_data_set.hpp index 8f42a6f..20992c4 100644 --- a/core/default_data_set.hpp +++ b/core/default_data_set.hpp @@ -30,7 +30,7 @@ private: return data_vec.size(); } - void do_push_back(const data& d) + void do_add_data(const data& d) { data_vec.push_back(d); } diff --git a/core/fitter.hpp b/core/fitter.hpp index 980cf83..38f05a3 100644 --- a/core/fitter.hpp +++ b/core/fitter.hpp @@ -28,7 +28,9 @@ namespace opt_utilities Tx x,x_lower_err,x_upper_err; Ty y,y_lower_err,y_upper_err; public: - data(const Tx& _x,const Ty& _y,const Ty& _y_lower_err,const Ty& _y_upper_err,const Tx& _x_lower_err,const Tx& _x_upper_err) + data(const Tx& _x,const Ty& _y, + const Ty& _y_lower_err, + const Ty& _y_upper_err,const Tx& _x_lower_err,const Tx& _x_upper_err) { opt_eq(x,_x); opt_eq(x_lower_err,_x_lower_err); @@ -147,7 +149,7 @@ namespace opt_utilities virtual const data& do_get_data(size_t i)const=0; virtual size_t do_size()const=0; - virtual void do_push_back(const data&)=0; + virtual void do_add_data(const data&)=0; virtual void do_clear()=0; virtual data_set* do_clone()const=0; @@ -164,9 +166,9 @@ namespace opt_utilities { return do_size(); } - void push_back(const data& d) + void add_data(const data& d) { - return do_push_back(d); + return do_add_data(d); } void clear() { @@ -200,12 +202,12 @@ namespace opt_utilities private: Tstr name; //bool frozen; - typename element_type_trait::element_type default_value; + typename element_type_trait::element_type value; public: param_info(const Tstr& _name, const typename element_type_trait::element_type& _v) - :name(_name),default_value(_v){} + :name(_name),value(_v){} param_info() :name() @@ -214,13 +216,13 @@ namespace opt_utilities param_info(const param_info& rhs) :name(rhs.name) { - opt_eq(default_value,rhs.default_value); + opt_eq(value,rhs.value); } param_info& operator=(const param_info& rhs) { name=rhs.name; - opt_eq(default_value,rhs.default_value); + opt_eq(value,rhs.value); return *this; } @@ -229,14 +231,14 @@ namespace opt_utilities return this->name; } - const typename element_type_trait::element_type& get_default_value()const + const typename element_type_trait::element_type& get_value()const { - return default_value; + return value; } - void set_default_value(const typename element_type_trait::element_type& x) + void set_value(const typename element_type_trait::element_type& x) { - opt_eq(default_value,x); + opt_eq(value,x); } void set_name(const Tstr& _name) @@ -385,8 +387,8 @@ namespace opt_utilities resize(result,param_info_list.size()); for(size_t i=0;iget_name()==pname) { - i->set_default_value(v); + i->set_value(v); return; } } @@ -428,7 +430,7 @@ namespace opt_utilities { for(size_t i=0;iget_param_info(pname).get_default_value(); + return p_model->get_param_info(pname).get_value(); } const param_info& get_param_info(const Tstr& pname)const diff --git a/core/freeze_param.hpp b/core/freeze_param.hpp index a292604..4424c58 100644 --- a/core/freeze_param.hpp +++ b/core/freeze_param.hpp @@ -81,8 +81,8 @@ namespace opt_utilities //std::cout<<"frozen:"< d(x[i],y[i],yl[i],(yu==0?yl[i]:yu[i]),(xl==0?0:xl[i]),(xu==0?0:xu[i])); // cout<second.fit.load_data(ds); } diff --git a/misc/bootstrap.hpp b/misc/bootstrap.hpp index 3ee53b1..924c86f 100644 --- a/misc/bootstrap.hpp +++ b/misc/bootstrap.hpp @@ -94,7 +94,7 @@ namespace opt_utilities data d; d=origin_data_set.get_data(i); d.set_y(rand_norm(d.get_y(),(d.get_y_upper_err()+d.get_y_lower_err())/2)); - current_data_set.push_back(d); + current_data_set.add_data(d); } p_fitter->load_data(current_data_set); p_fitter->set_param_value(origin_param); diff --git a/samples/a.dat b/samples/a.dat index 8ca360f..ea2ff04 100644 --- a/samples/a.dat +++ b/samples/a.dat @@ -1,4 +1,4 @@ -0 4 3 5 -1 7 6 8 -2 10 9 11 -3 13 12 14 +0 4 +1 7 +2 10 +3 13 -- cgit v1.2.2