improved performance of dogleg

This commit is contained in:
Val Erastov 2015-03-18 23:31:23 -07:00
parent ff89d478e7
commit 3d2fe14426

View file

@ -371,7 +371,6 @@ optim.dog_leg = function (subsys, rough) {
stop = 6;
}
else {
var Jt = n.transpose(Jx);
// get the gauss-newton step
//h_gn = n.solve(Jx, n.mul(fx, -1));
@ -386,10 +385,6 @@ optim.dog_leg = function (subsys, rough) {
//solve linear problem using svd formula to get the gauss-newton step
//h_gn = lls(Jx, n.mul(fx, -1));
var rel_error = n.norm2(n.add(n.dot(Jx, h_gn), fx)) / n.norm2(fx);
if (rel_error > 1e15)
break;
var hitBoundary = false;
var stepKind;
@ -404,6 +399,7 @@ optim.dog_leg = function (subsys, rough) {
stepKind = 1;
}
else {
var Jt = n.transpose(Jx);
var B = n.dot(Jt, Jx);
var gBg = n.dot(g, n.dot(B, g));
alpha = n.norm2Squared(g) / gBg;