changeset 8550:1cb63ac13934

allow fsolve work without qrupdate
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 21 Jan 2009 07:07:12 +0100
parents 424ba638d8f1
children 906f976d35a8
files scripts/ChangeLog scripts/optimization/fsolve.m
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Jan 20 20:02:43 2009 -0500
+++ b/scripts/ChangeLog	Wed Jan 21 07:07:12 2009 +0100
@@ -1,3 +1,7 @@
+2009-01-20  Jaroslav Hajek  <highegg@gmail.com>
+
+	* optimization/fsolve.m: Only use qrupdate if available.
+
 2009-01-20  John W. Eaton  <jwe@octave.org>
 
 	* general/postpad.m: Doc fix.
--- a/scripts/optimization/fsolve.m	Tue Jan 20 20:02:43 2009 -0500
+++ b/scripts/optimization/fsolve.m	Wed Jan 21 07:07:12 2009 +0100
@@ -67,6 +67,8 @@
 
 function [x, fvec, info, output, fjac] = fsolve (fcn, x0, options)
 
+  persistent have_qrupdate = exist ('qrupdate') == 5;
+
   if (nargin < 3)
     options = struct ();
   endif
@@ -266,7 +268,11 @@
       endif
 
       ## Update the QR factorization.
-      [q, r] = qrupdate (q, r, u, v);
+      if (have_qrupdate)
+        [q, r] = qrupdate (q, r, u, v);
+      else
+        [q, r] = qr (q*r + u*v');
+      endif
 
     endwhile
   endwhile