aboutsummaryrefslogtreecommitdiffstats
path: root/error_estimator
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2011-01-04 14:41:29 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2011-01-04 14:41:29 +0000
commita620837fc33ef740e95f8092df0cfe7d4222a656 (patch)
tree8e11d17f8764e3d7bbc126126d9e6b4237c0e4f8 /error_estimator
parentc38a8d7c3cca296c9f9a70bc3504075b416c68b6 (diff)
downloadopt-utilities-a620837fc33ef740e95f8092df0cfe7d4222a656.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@153 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'error_estimator')
-rw-r--r--error_estimator/error_estimator.hpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/error_estimator/error_estimator.hpp b/error_estimator/error_estimator.hpp
index 1e9fa84..4324cd0 100644
--- a/error_estimator/error_estimator.hpp
+++ b/error_estimator/error_estimator.hpp
@@ -2,14 +2,24 @@
#define ERROR_EST
#include <core/fitter.hpp>
#include <iostream>
+#include <vector>
+#include <string>
namespace opt_utilities
{
template <typename Ty,typename Tx,typename Tp,typename Ts,typename Tstr>
void estimate_error(fitter<Ty,Tx,Tp,Ts>& fit,const Tstr& pname,typename element_type_trait<Tp>::element_type& lower,typename element_type_trait<Tp>::element_type& upper,const Ts& dchi)
{
-
typedef typename element_type_trait<Tp>::element_type Tpe;
+ std::vector<Tstr> pnames;
+ std::vector<Tpe> pvalues;
+
+ for(int i=0;i<fit.get_num_params();++i)
+ {
+ pnames.push_back(fit.get_param_info(i).get_name());
+ pvalues.push_back(fit.get_param_info(i).get_value());
+ }
+
fit.fit();
if(fit.report_param_status(pname)=="frozen")
{
@@ -76,9 +86,15 @@ namespace opt_utilities
}
}
- fit.set_param_value(pname,current_value);
+ for(int i=0;i<fit.get_num_params();++i)
+ {
+ fit.set_param_value(pnames[i],pvalues[i]);
+ }
+
fit.fit();
+
+
////
Tpe lower1=current_value;
step=current_value-lower;
@@ -127,7 +143,12 @@ namespace opt_utilities
}
dynamic_cast<freeze_param<Ty,Tx,Tp,Tstr>& >(fit.get_param_modifier())-=freeze_param<Ty,Tx,Tp,Tstr>(pname);
+ for(int i=0;i<fit.get_num_params();++i)
+ {
+ fit.set_param_value(pnames[i],pvalues[i]);
+ }
+ fit.fit();
}
}