10 double,
int,
int,
double>())
30 double Threshold,
int Max_iteration,
int Max_divergence,
double Max_chisq)
32 threshold(Threshold), max_iteration(Max_iteration),
33 max_divergence(Max_divergence), max_chisq(Max_chisq)
49 bool& convergence_failed,
53 has_converged =
false;
54 convergence_failed =
false;
55 step_diverged =
false;
67 else if(fabs(r2)<(-r1*(1e-20)))
72 if(ratio < 0.25 && fs.number_iteration > 1) {
84 if(ratio <= 0.0001 && fs.number_iteration > 1) {
88 convergence_failed =
true;
96 convergence_failed =
true;
104 const blitz::Array<double, 1>& Residual,
105 const blitz::Array<double, 1>& Residual_cov_diag)
108 throw Exception(
"Can not evaulate quality when the fit has not succeeded");
111 int quality_count = 0;
113 for(
int i = 0; i < fm->num_channels(); ++i) {
114 boost::optional<blitz::Range> pr = fm->stacked_pixel_range(i);
117 Residual_cov_diag(*pr));
119 if(chisq_m < max_chisq)
124 if (quality_count == nband)
137 Os <<
"ConnorConvergence\n" 138 <<
" threshold: " << threshold <<
"\n" 139 <<
" max_iteration: " << max_iteration <<
"\n";
This class holds various parameters describing how good of a fit we have.
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 is the base of the exception hierarchy for Full Physics code.
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...
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
double gamma2_fc() const
Parameter "gamma2_fc", which is just chisq_apriori_fc + chisq_measured_fc.
double chisq_measure_norm(const blitz::Array< double, 1 > &Residual, const blitz::Array< double, 1 > &Residual_cov_diag) const
Calculate chisq for given residual and covariance matrix.
int number_divergent
Number of divergent steps.
This class tests for convergence of a Levenberg-Marquardt solver.
bool fit_succeeded
Was the fit successful?
This class tests for convergence of a Levenberg-Marquardt solver.
OUTCOME outcome
Flag indicating success of fit, or why fit wasn't succesful.
double d_sigma_sq_scaled
This is d_sigma_sq, scaled by the size of the state vector.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
#define REGISTER_LUA_END()
#define range_min_check(V, Min)
Range check.
int number_iteration
Number of iterations.
ConnorConvergence(const boost::shared_ptr< ForwardModel > &Fm, double Threshold, int Max_iteration, int Max_divergence, double Max_chisq)
Constructor.
double gamma2() const
Parameter "gamma2", which is just chi2_apriori + chi2_measured.
virtual void print(std::ostream &Os) const
Print description of object.