+ prevent possibly infinite loop in the Levenberg-Marquardt solver

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5132 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
logari81 2011-11-14 18:40:54 +00:00
parent 84be918bec
commit 8c65bec480

View File

@ -665,7 +665,8 @@ int System::solve_LM(SubSystem* subsys)
mu = tau * A.diagonal().lpNorm<Eigen::Infinity>();
// determine increment using adaptive damping
while (1) {
int k=0;
while (k < 50) {
// augment normal equations A = A+uI
for (int i=0; i < xsize; ++i)
A(i,i) += mu;
@ -716,6 +717,12 @@ int System::solve_LM(SubSystem* subsys)
nu*=2.0;
for (int i=0; i < xsize; ++i) // restore diagonal J^T J entries
A(i,i) = diag_A(i);
k++;
}
if (k > 50) {
stop = 7;
break;
}
}