aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-04-02 12:28:41 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-04-02 12:28:41 +0000
commit940839ecd20a5c194ce6076240f04b0e98cd8fde (patch)
tree7911ca3175d526f867ff288bd61f61d6a4ab56c9
parent4954b5638ced13c2f9d2f0ec4dca77b03f7e89d0 (diff)
downloadopt-utilities-940839ecd20a5c194ce6076240f04b0e98cd8fde.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@12 ed2142bd-67ad-457f-ba7c-d818d4011675
-rw-r--r--core/default_data_set.hpp2
-rw-r--r--core/fitter.hpp36
-rw-r--r--core/freeze_param.hpp4
-rw-r--r--interface/opt.cc2
-rw-r--r--misc/bootstrap.hpp2
-rw-r--r--samples/a.dat8
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<Ty,Tx>& d)
+ void do_add_data(const data<Ty,Tx>& 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<Ty,Tx>& do_get_data(size_t i)const=0;
virtual size_t do_size()const=0;
- virtual void do_push_back(const data<Ty,Tx>&)=0;
+ virtual void do_add_data(const data<Ty,Tx>&)=0;
virtual void do_clear()=0;
virtual data_set<Ty,Tx>* do_clone()const=0;
@@ -164,9 +166,9 @@ namespace opt_utilities
{
return do_size();
}
- void push_back(const data<Ty,Tx>& d)
+ void add_data(const data<Ty,Tx>& 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<Tp>::element_type default_value;
+ typename element_type_trait<Tp>::element_type value;
public:
param_info(const Tstr& _name,
const typename element_type_trait<Tp>::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<Tp>::element_type& get_default_value()const
+ const typename element_type_trait<Tp>::element_type& get_value()const
{
- return default_value;
+ return value;
}
- void set_default_value(const typename element_type_trait<Tp>::element_type& x)
+ void set_value(const typename element_type_trait<Tp>::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;i<param_info_list.size();++i)
{
- //opt_eq(get_element(result,i),param_info_list[i].get_default_value());
- set_element(result,i,param_info_list[i].get_default_value());
+ //opt_eq(get_element(result,i),param_info_list[i].get_value());
+ set_element(result,i,param_info_list[i].get_value());
//get_element((Tp)result,i);
}
return result;
@@ -416,7 +418,7 @@ namespace opt_utilities
{
if(i->get_name()==pname)
{
- i->set_default_value(v);
+ i->set_value(v);
return;
}
}
@@ -428,7 +430,7 @@ namespace opt_utilities
{
for(size_t i=0;i<param_info_list.size();++i)
{
- param_info_list[i].set_default_value(get_element(param,i));
+ param_info_list[i].set_value(get_element(param,i));
}
}
@@ -742,7 +744,7 @@ namespace opt_utilities
{
throw model_undefined();
}
- return p_model->get_param_info(pname).get_default_value();
+ return p_model->get_param_info(pname).get_value();
}
const param_info<Tp,Tstr>& 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:"<<pinf.get_name()
// <<i<<"\t"<<j
// <<std::endl;
- //opt_eq(get_element(reformed_p,i),pinf.get_default_value());
- set_element(reformed_p,i,pinf.get_default_value());
+ //opt_eq(get_element(reformed_p,i),pinf.get_value());
+ set_element(reformed_p,i,pinf.get_value());
}
else
{
diff --git a/interface/opt.cc b/interface/opt.cc
index 585d2e9..ce492d1 100644
--- a/interface/opt.cc
+++ b/interface/opt.cc
@@ -72,7 +72,7 @@ void load_data_(const int& nfit,const int& ndatas,double* x,double* y,double* yl
{
data<double,double> d(x[i],y[i],yl[i],(yu==0?yl[i]:yu[i]),(xl==0?0:xl[i]),(xu==0?0:xu[i]));
// cout<<x[i]<<" "<<y[i]<<endl;
- ds.push_back(d);
+ ds.add_data(d);
}
iter->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<Ty,Tx> 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