# HG changeset patch # User Jaroslav Hajek # Date 1233144117 -3600 # Node ID 3d75d717cbe05ebb3c83a4a560465ed58f4d3916 # Parent 7baacb6a8a65283d401eda522513934a34fea28d do not pivot by default in fsolve diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2009-01-28 Jaroslav Hajek + + * optimization/fsolve.m: Don't use pivoting at all (for the time + being). + 2009-01-28 Jaroslav Hajek * optimization/fsolve.m: Use more adaptive rescaling. diff --git a/scripts/optimization/fsolve.m b/scripts/optimization/fsolve.m --- a/scripts/optimization/fsolve.m +++ b/scripts/optimization/fsolve.m @@ -154,18 +154,12 @@ useqr = updating && m >= n && n > 10; if (useqr) - ## Get QR factorization of the jacobian, optionally with column pivoting. - ## TODO: pivoting is only done in the first step, to get invariance - ## w.r.t. permutations of variables. Maybe it could be beneficial to - ## repivot occassionally? - if (niter == 1) - [q, r, p] = qr (fjac, 0); - ## p is a column vector. Blame Matlab for the inconsistency. - ## Octave can handle permutation matrices gracefully. - p = eye (n)(:, p); - else - [q, r] = qr (fjac*p, 0); - endif + ## FIXME: Currently, pivoting is mostly useless because the \ operator + ## cannot exploit the resulting props of the triangular factor. + ## Unpivoted QR is significantly faster so it doesn't seem right to pivot + ## just to get invariance. Original MINPACK didn't pivot either, at least + ## when qr updating was used. + [q, r] = qr (fjac, 0); endif ## Get column norms, use them as scaling factors. @@ -327,7 +321,6 @@ if (useqr) u = (fvec1 - q*w) / sn; v = dg .* ((dg .* s) / sn); - v = p' * v; ## Update the QR factorization. [q, r] = qrupdate (q, r, u, v);