# HG changeset patch # User jwe # Date 1173130180 0 # Node ID f74e71ef6612233e12c4921fb5d8b05fda0606ed # Parent 8a844b3d10b18fc1c4332597678b6e7798558548 [project @ 2007-03-05 21:29:40 by jwe] diff -r 8a844b3d10b1 -r f74e71ef6612 scripts/ChangeLog --- a/scripts/ChangeLog Mon Mar 05 18:41:57 2007 +0000 +++ b/scripts/ChangeLog Mon Mar 05 21:29:40 2007 +0000 @@ -1,3 +1,8 @@ +2007-03-05 John W. Eaton + + * optimization/sqp.m: Defer first call to obj_hess until after + calling obj_fun. + 2007-03-02 Bob Weigel * specfun/nchoosek.m: Fix nargin check. diff -r 8a844b3d10b1 -r f74e71ef6612 scripts/optimization/sqp.m --- 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);