mirror of
https://github.com/xibyte/jsketcher
synced 2026-01-26 10:05:31 +01:00
Use LU factorization for determing Guess Newton step
This commit is contained in:
parent
81b217bf2e
commit
021053aaee
1 changed files with 12 additions and 9 deletions
|
|
@ -299,20 +299,23 @@ optim.dog_leg = function (subsys, rough) {
|
|||
err = subsys.calcResidual(fx);
|
||||
subsys.fillJacobian(Jx);
|
||||
|
||||
function lsolve(A, b) {
|
||||
// if (csize < xsize) {
|
||||
// var At = n.transpose(A);
|
||||
// var J = n.dot(At, A);
|
||||
// var r = n.dot(At, b);;
|
||||
// return n.solve(J, r);
|
||||
// } else {
|
||||
// return n.solve(A, b);
|
||||
// }
|
||||
function lsolve_slow(A, b) {
|
||||
var At = n.transpose(A);
|
||||
var res = n.dot(n.dot(At, optim.inv(n.dot(A, At))), b);
|
||||
return res;
|
||||
}
|
||||
|
||||
function lsolve(A, b) {
|
||||
if (csize < xsize) {
|
||||
var At = n.transpose(A);
|
||||
var sol = n.solve(n.dot(A, At), b);
|
||||
return n.dot(At, sol);
|
||||
} else {
|
||||
return n.solve(A, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var g = n.dot(n.transpose(Jx), fx);
|
||||
// get the infinity norm fx_inf and g_inf
|
||||
var g_inf = n.norminf(g);
|
||||
|
|
|
|||
Loading…
Reference in a new issue