11 double dropf,
double boostf,
14 : stopping_criteria_(stopping_criteria), dropf_(dropf), boostf_(boostf),
15 min_chisq_(min_chisq), max_iteration_(max_iteration)
30 bool& convergence_failed,
34 using namespace blitz;
35 has_converged =
false;
36 convergence_failed =
false;
37 step_diverged =
false;
43 convergence_failed =
true;
45 }
else if(chisq >= chisqlast) {
47 gamma = (1 + gamma) * boostf_ - 1;
48 }
else if(chisq <= min_chisq_ ||
49 fabs((chisqlast - chisq) / chisq) <= stopping_criteria_) {
52 gamma = (1 + gamma) * dropf_ - 1;
60 const blitz::Array<double, 1>& Residual,
61 const blitz::Array<double, 1>& Residual_cov_diag)
64 throw Exception(
"Can not evaulate quality when the fit has not succeeded");
81 Os <<
"ChisqConvergence:\n" 82 <<
" Stopping criteria: " << stopping_criteria_ <<
"\n" 83 <<
" Drop factor: " << dropf_ <<
"\n" 84 <<
" Boost factor: " << boostf_ <<
"\n" 85 <<
" Min Chisq: " << min_chisq_ <<
"\n" 86 <<
" Max iteration: " << max_iteration_ <<
"\n";
#define range_check(V, Min, Max)
Range check.
virtual void convergence_check(const FitStatistic &fit_stat_last, FitStatistic &fit_stat, bool &has_converged, bool &convergence_failed, double &gamma, bool &step_diverged)
Check for the convergence of a Solver, or if we have taken a divergent step.
This class holds various parameters describing how good of a fit we have.
virtual void evaluate_quality(FitStatistic &fit_stat, const blitz::Array< double, 1 > &Residual, const blitz::Array< double, 1 > &Residual_cov_diag)
Evaluates the quality of a converged fit from the residuals and expected residual error...
This is the base of the exception hierarchy for Full Physics code.
Apply value function to a blitz array.
bool fit_succeeded
Was the fit successful?
OUTCOME outcome
Flag indicating success of fit, or why fit wasn't succesful.
ChisqConvergence(double stopping_criteria=0.001, double dropf=0.1, double boostf=10, double min_chisq=0.01, int max_iteration=50)
Constructor.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
double chisq_measured
Chisq of the residuals of the measurement vs. model prediction.
#define range_min_check(V, Min)
Range check.
int number_iteration
Number of iterations.
virtual void print(std::ostream &Os) const
Print object to stream.