function pk = findDirction(gk,n,Hk,delta) %FINDDIRCTION search dirction of modified Newton's method.CMSC 764 HW1. % pk = findDirction(gk,n,Hk,delta) finds the search direction pk in % Newton's method for given gradient gk, dimension n and hessian Hk. % When the hessian is not s.p.d,we modify by Hk <- Hk + delta*I. % Here the solving of equations is done by Cholesky factorization. % % See also NEWTONMIN,FINDDELTALM % Dianne P. O'Leary oleary@cs.umd.edu % Geping Liu geping@math.umd.edu % 09-21-06 if (delta ~= 0) for i = 1 : n Hk(i,i) = Hk(i,i) + delta; end end R = chol(Hk); y = R' \ (- gk); pk = R \ y ;