Changed nonlinear convergence to <= (from <)

release/4.3a0
Richard Roberts 2012-03-24 19:53:32 +00:00
parent 5be3af8d6d
commit daae77771b
1 changed files with 4 additions and 4 deletions

View File

@ -90,7 +90,7 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold
// check if diverges // check if diverges
double absoluteDecrease = currentError - newError; double absoluteDecrease = currentError - newError;
if (verbosity >= 2) { if (verbosity >= 2) {
if (absoluteDecrease < absoluteErrorTreshold) if (absoluteDecrease <= absoluteErrorTreshold)
cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " < " << absoluteErrorTreshold << endl; cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " < " << absoluteErrorTreshold << endl;
else else
cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " >= " << absoluteErrorTreshold << endl; cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " >= " << absoluteErrorTreshold << endl;
@ -99,13 +99,13 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold
// calculate relative error decrease and update currentError // calculate relative error decrease and update currentError
double relativeDecrease = absoluteDecrease / currentError; double relativeDecrease = absoluteDecrease / currentError;
if (verbosity >= 2) { if (verbosity >= 2) {
if (relativeDecrease < relativeErrorTreshold) if (relativeDecrease <= relativeErrorTreshold)
cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " < " << relativeErrorTreshold << endl; cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " < " << relativeErrorTreshold << endl;
else else
cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " >= " << relativeErrorTreshold << endl; cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " >= " << relativeErrorTreshold << endl;
} }
bool converged = (relativeErrorTreshold && (relativeDecrease < relativeErrorTreshold)) bool converged = (relativeErrorTreshold && (relativeDecrease <= relativeErrorTreshold))
|| (absoluteDecrease < absoluteErrorTreshold); || (absoluteDecrease <= absoluteErrorTreshold);
if (verbosity >= 1 && converged) { if (verbosity >= 1 && converged) {
if(absoluteDecrease >= 0.0) if(absoluteDecrease >= 0.0)
cout << "converged" << endl; cout << "converged" << endl;