From 1f716fe1c51904cba8464a4c999110554e98e363 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Tue, 4 Jan 2011 15:20:38 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@154 ed2142bd-67ad-457f-ba7c-d818d4011675 --- error_estimator/error_estimator.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'error_estimator') diff --git a/error_estimator/error_estimator.hpp b/error_estimator/error_estimator.hpp index 4324cd0..a6c6163 100644 --- a/error_estimator/error_estimator.hpp +++ b/error_estimator/error_estimator.hpp @@ -1,6 +1,7 @@ #ifndef ERROR_EST #define ERROR_EST #include +#include #include #include #include @@ -8,7 +9,7 @@ namespace opt_utilities { template - void estimate_error(fitter& fit,const Tstr& pname,typename element_type_trait::element_type& lower,typename element_type_trait::element_type& upper,const Ts& dchi) + void estimate_error(fitter& fit,const Tstr& pname,typename element_type_trait::element_type& lower,typename element_type_trait::element_type& upper,const Ts& dchi,const Ts& precision) { typedef typename element_type_trait::element_type Tpe; std::vector pnames; @@ -41,16 +42,24 @@ namespace opt_utilities Tpe current_value= fit.get_param_value(pname); + + if(lower>=current_value||upper<=current_value) + { + std::cerr<<"Error, initial lower and upper limits should be smaller and larger than the best fit value, respectively"<current_chi+dchi) { break; @@ -59,7 +68,7 @@ namespace opt_utilities } Ts target_chi=current_chi+dchi; - while(upper-upper1>1E-10) + while(upper-upper1>std::abs(precision)) { std::cerr<1E-10) + while(lower1-lower>std::abs(precision)) { fit.set_param_value(pname,lower1); fit.fit(); -- cgit v1.2.2