diff scripts/optimization/fsolve.m @ 8592:dacfd030633a

handle sparse jacobians in fsolve
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 26 Jan 2009 15:46:33 +0100
parents c136d313206a
children 8833c0b18eb2
line wrap: on
line diff
--- a/scripts/optimization/fsolve.m
+++ b/scripts/optimization/fsolve.m
@@ -119,6 +119,10 @@
     ## Handle arbitrary shapes of x and f and remember them.
     if (has_jac)
       [fvec, fjac] = fcn (reshape (x, xsiz));
+      ## If the jacobian is sparse, disable Broyden updating.
+      if (issparse (fjac))
+        updating = false;
+      endif
       nfev ++;
     else
       [fvec, fjac] = __fdjac__ (fcn, reshape (x, xsiz));