aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2008-12-26 03:20:37 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2008-12-26 03:20:37 +0000
commita0453ea575e4e4aed87004d2587bf9b95c10f1a9 (patch)
treede5f660ca14b97f7d8cba77fba828e1a91adb6ff /core
parent7ccc4c51889a77168befc11de4344e19dc210e30 (diff)
downloadopt-utilities-a0453ea575e4e4aed87004d2587bf9b95c10f1a9.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@4 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'core')
-rw-r--r--core/default_data_set.hpp4
-rw-r--r--core/fitter.hpp32
-rw-r--r--core/freeze_param.hpp18
3 files changed, 27 insertions, 27 deletions
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<Ty,Tx>& do_get_data(int i)const
+ const data<Ty,Tx>& 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<Ty,Tx>& do_get_data(int i)const=0;
- virtual int do_size()const=0;
+ 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_clear()=0;
virtual data_set<Ty,Tx>* do_clone()const=0;
@@ -156,11 +156,11 @@ namespace opt_utilities
delete this;
}
public:
- const data<Ty,Tx>& get_data(int i)const
+ const data<Ty,Tx>& 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<Tp,Tstr>& get_param_info(int n)const
+ const param_info<Tp,Tstr>& 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;i<param_info_list.size();++i)
{
if(param_info_list[i].get_name()==pname)
{
@@ -754,7 +754,7 @@ namespace opt_utilities
return p_model->get_param_info(pname);
}
- const param_info<Tp,Tstr>& get_param_info(int n)const
+ const param_info<Tp,Tstr>& 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<Tstr> param_names;
- std::vector<int> param_num;
- int num_free;
+ std::vector<size_t> 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;i<nparams;++i)
{
if(this->is_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(;i<get_size(p);++i)
{
//std::cout<<is_frozen(j)<<"\n";
if(!this->is_frozen(i))