home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 4.ddi / OPTIM.DI$ / UPDHESS.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  897 b   |  35 lines

  1. function [invhess,directn]=updhess(xnew,xold,gradxnew,gradxold,invhess,para)
  2. %UPDHESS Performs the Inverse Hessian Update.
  3. %    Returns direction of search for use with 
  4. %    unconstrained optimization problems. 
  5.  
  6. %    Copyright (c) 1990 by the MathWorks, Inc.
  7. %    Andy Grace 7-9-90.
  8.  
  9. u=xnew-xold;
  10. v=gradxnew-gradxold;
  11. if para(1,6)==0
  12. % The BFGS Hessian Update formula:
  13.     invhess=invhess + v*v'/(v'*u)  -invhess*u*u'*invhess'/(u'*invhess*u);
  14.     directn=-invhess\gradxnew;
  15.  
  16. elseif para(1,6)==1
  17.  
  18. % The DFP formula
  19.     a=u*u'/(u'*v);
  20.     b=-invhess*v*v'*invhess'/(v'*invhess*v);
  21.     invhess=invhess + a + b;
  22.     directn=-invhess*gradxnew;
  23.  
  24. elseif para(1,6)==3
  25.  
  26. % A formula given by Gill and Murray
  27.     a = 1/(v'*u);
  28.     invhess=invhess - a*(invhess*v*u'+u*v'*invhess)+a*(1+v'*invhess*v*a)*u*u' ;
  29.        directn=-invhess*gradxnew;
  30. elseif para(1,6)==2
  31. % Steepest Descent
  32.     directn=-gradxnew;
  33. end
  34.        
  35.