From a0453ea575e4e4aed87004d2587bf9b95c10f1a9 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Fri, 26 Dec 2008 03:20:37 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@4 ed2142bd-67ad-457f-ba7c-d818d4011675 --- core/default_data_set.hpp | 4 ++-- core/fitter.hpp | 32 ++++++++++++++++---------------- core/freeze_param.hpp | 18 +++++++++--------- 3 files changed, 27 insertions(+), 27 deletions(-) (limited to 'core') diff --git a/core/default_data_set.hpp b/core/default_data_set.hpp index be06c04..8f42a6f 100644 --- a/core/default_data_set.hpp +++ b/core/default_data_set.hpp @@ -20,12 +20,12 @@ private: } - const data& do_get_data(int i)const + const data& do_get_data(size_t i)const { return data_vec.at(i); } - int do_size()const + size_t do_size()const { return data_vec.size(); } diff --git a/core/fitter.hpp b/core/fitter.hpp index ed90a83..980cf83 100644 --- a/core/fitter.hpp +++ b/core/fitter.hpp @@ -145,8 +145,8 @@ namespace opt_utilities { private: - virtual const data& do_get_data(int i)const=0; - virtual int do_size()const=0; + 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_clear()=0; virtual data_set* do_clone()const=0; @@ -156,11 +156,11 @@ namespace opt_utilities delete this; } public: - const data& get_data(int i)const + const data& get_data(size_t i)const { return this->do_get_data(i); } - int size()const + size_t size()const { return do_size(); } @@ -373,7 +373,7 @@ namespace opt_utilities return null_param; } - const param_info& get_param_info(int n)const + const param_info& get_param_info(size_t n)const { return param_info_list[n%get_num_params()]; } @@ -393,16 +393,16 @@ namespace opt_utilities } - int get_num_params()const + size_t get_num_params()const { - return (int)param_info_list.size(); + return param_info_list.size(); } - int get_num_free_params()const + size_t get_num_free_params()const { if(p_param_modifier) { - return (int)p_param_modifier->get_num_free_params(); + return p_param_modifier->get_num_free_params(); } return get_num_params(); } @@ -432,9 +432,9 @@ namespace opt_utilities } } - int get_param_order(const Tstr& pname)const + size_t get_param_order(const Tstr& pname)const { - for(int i=0;i<(int)param_info_list.size();++i) + for(size_t i=0;iget_param_info(pname); } - const param_info& get_param_info(int n)const + const param_info& get_param_info(size_t n)const { if(p_model==0) { @@ -763,7 +763,7 @@ namespace opt_utilities return p_model->get_param_info(n); } - const int get_param_order(const Tstr& pname)const + size_t get_param_order(const Tstr& pname)const { if(p_model==0) { @@ -772,7 +772,7 @@ namespace opt_utilities return p_model->get_param_order(pname); } - int get_num_params()const + size_t get_num_params()const { if(p_model==0) { @@ -1006,7 +1006,7 @@ namespace opt_utilities return *(this->p_model); } - int get_num_free_params()const + size_t get_num_free_params()const { return do_get_num_free_params(); } @@ -1021,7 +1021,7 @@ namespace opt_utilities private: virtual Tp do_reform(const Tp& p)const=0; virtual Tp do_deform(const Tp& p)const=0; - virtual int do_get_num_free_params()const=0; + virtual size_t do_get_num_free_params()const=0; virtual Tstr do_report_param_status(const Tstr&)const=0; virtual void update(){} diff --git a/core/freeze_param.hpp b/core/freeze_param.hpp index 8ba677a..a292604 100644 --- a/core/freeze_param.hpp +++ b/core/freeze_param.hpp @@ -12,8 +12,8 @@ namespace opt_utilities { private: std::set param_names; - std::vector param_num; - int num_free; + std::vector param_num; + size_t num_free; public: freeze_param() @@ -53,12 +53,12 @@ namespace opt_utilities } } - int do_get_num_free_params()const + size_t do_get_num_free_params()const { return this->get_model().get_num_params()-param_num.size(); } - bool is_frozen(int i)const + bool is_frozen(size_t i)const { if(find(param_num.begin(),param_num.end(),i)==param_num.end()) { @@ -70,10 +70,10 @@ namespace opt_utilities Tp do_reform(const Tp& p)const { - int nparams=(this->get_model().get_num_params()); + size_t nparams=(this->get_model().get_num_params()); Tp reformed_p(nparams); - int i=0,j=0; - for(i=0;i<(int)nparams;++i) + size_t i=0,j=0; + for(i=0;iis_frozen(i)) { @@ -105,9 +105,9 @@ namespace opt_utilities Tp do_deform(const Tp& p)const { Tp deformed_p(do_get_num_free_params()); - int i(0),j(0); + size_t i(0),j(0); assert(get_size(p)==this->get_model().get_num_params()); - for(;i<(int)get_size(p);++i) + for(;iis_frozen(i)) -- cgit v1.2.2