From 3d2fe14426c8560f7aa8f8503c4efe8d02bbd45a Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Wed, 18 Mar 2015 23:31:23 -0700 Subject: [PATCH] improved performance of dogleg --- web/app/math/noptim.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/web/app/math/noptim.js b/web/app/math/noptim.js index 369f6cdf..ce74efa9 100644 --- a/web/app/math/noptim.js +++ b/web/app/math/noptim.js @@ -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;