📄 updhess.m
字号:
function [invhess,directn]=updhess(xnew,xold,gradxnew,gradxold,invhess,para)
%UPDHESS Performs the Inverse Hessian Update.
% Returns direction of search for use with
% unconstrained optimization problems.
% Copyright (c) 1990 by the MathWorks, Inc.
% Andy Grace 7-9-90.
u=xnew-xold;
v=gradxnew-gradxold;
if para(1,6)==0
% The BFGS Hessian Update formula:
invhess=invhess + v*v'/(v'*u) -invhess*u*u'*invhess'/(u'*invhess*u);
directn=-invhess\gradxnew;
elseif para(1,6)==1
% The DFP formula
a=u*u'/(u'*v);
b=-invhess*v*v'*invhess'/(v'*invhess*v);
invhess=invhess + a + b;
directn=-invhess*gradxnew;
elseif para(1,6)==3
% A formula given by Gill and Murray
a = 1/(v'*u);
invhess=invhess - a*(invhess*v*u'+u*v'*invhess)+a*(1+v'*invhess*v*a)*u*u' ;
directn=-invhess*gradxnew;
elseif para(1,6)==2
% Steepest Descent
directn=-gradxnew;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -