diff scripts/optimization/sqp.m @ 6382:f74e71ef6612

[project @ 2007-03-05 21:29:40 by jwe]
author jwe
date Mon, 05 Mar 2007 21:29:40 +0000
parents 34f96dd5441b
children 2a04f026ef54
line wrap: on
line diff
--- a/scripts/optimization/sqp.m	Mon Mar 05 18:41:57 2007 +0000
+++ b/scripts/optimization/sqp.m	Mon Mar 05 21:29:40 2007 +0000
@@ -179,8 +179,6 @@
 
     n = length (x);
 
-    B = eye (n, n);
-
     ## Evaluate objective function, constraints, and gradients at initial
     ## value of x.
     ##
@@ -200,7 +198,6 @@
 	  if (length (objf) > 2)
 	    obj_hess = objf{3};
 	    have_hess = 1;
-	    B = feval (obj_hess, x);
 	  endif
 	endif
       else
@@ -257,6 +254,12 @@
 
     c = feval (obj_grd, x);
 
+    if (have_hess)
+      B = feval (obj_hess, x);
+    else
+      B = eye (n, n);
+    endif
+
     ce = feval (ce_fun, x);
     F = feval (ce_grd, x);