76 lines
3.9 KiB
HTML
76 lines
3.9 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Description of bfgsi</title>
|
||
|
<meta name="keywords" content="bfgsi">
|
||
|
<meta name="description" content="H = bfgsi(H0,dg,dx)">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||
|
<meta name="generator" content="m2html © 2003 Guillaume Flandin">
|
||
|
<meta name="robots" content="index, follow">
|
||
|
<link type="text/css" rel="stylesheet" href="../m2html.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<a name="_top"></a>
|
||
|
<div><a href="../index.html">Home</a> > <a href="index.html">.</a> > bfgsi.m</div>
|
||
|
|
||
|
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td>
|
||
|
<td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
|
||
|
|
||
|
<h1>bfgsi
|
||
|
</h1>
|
||
|
|
||
|
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="box"><strong>H = bfgsi(H0,dg,dx)</strong></div>
|
||
|
|
||
|
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="box"><strong>function H = bfgsi(H0,dg,dx) </strong></div>
|
||
|
|
||
|
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="fragment"><pre class="comment"> H = bfgsi(H0,dg,dx)
|
||
|
dg is previous change in gradient; dx is previous change in x;
|
||
|
6/8/93 version that updates inverse hessian instead of hessian
|
||
|
itself.
|
||
|
Copyright by Christopher Sims 1996. This material may be freely
|
||
|
reproduced and modified.</pre></div>
|
||
|
|
||
|
<!-- crossreference -->
|
||
|
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
This function calls:
|
||
|
<ul style="list-style-image:url(../matlabicon.gif)">
|
||
|
</ul>
|
||
|
This function is called by:
|
||
|
<ul style="list-style-image:url(../matlabicon.gif)">
|
||
|
<li><a href="csminwel.html" class="code" title="function [fh,xh,gh,H,itct,fcount,retcodeh] = csminwel(fcn,x0,H0,grad,crit,nit,varargin)">csminwel</a> [fhat,xhat,ghat,Hhat,itct,fcount,retcodehat] = csminwel(fcn,x0,H0,grad,crit,nit,varargin)</li></ul>
|
||
|
<!-- crossreference -->
|
||
|
|
||
|
|
||
|
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
|
||
|
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function H = bfgsi(H0,dg,dx)</a>
|
||
|
0002 <span class="comment">% H = bfgsi(H0,dg,dx)</span>
|
||
|
0003 <span class="comment">% dg is previous change in gradient; dx is previous change in x;</span>
|
||
|
0004 <span class="comment">% 6/8/93 version that updates inverse hessian instead of hessian</span>
|
||
|
0005 <span class="comment">% itself.</span>
|
||
|
0006 <span class="comment">% Copyright by Christopher Sims 1996. This material may be freely</span>
|
||
|
0007 <span class="comment">% reproduced and modified.</span>
|
||
|
0008 <span class="keyword">if</span> size(dg,2)>1
|
||
|
0009 dg=dg';
|
||
|
0010 <span class="keyword">end</span>
|
||
|
0011 <span class="keyword">if</span> size(dx,2)>1
|
||
|
0012 dx=dx';
|
||
|
0013 <span class="keyword">end</span>
|
||
|
0014 Hdg = H0*dg;
|
||
|
0015 dgdx = dg'*dx;
|
||
|
0016 <span class="keyword">if</span> (abs(dgdx) >1e-12)
|
||
|
0017 H = H0 + (1+(dg'*Hdg)/dgdx)*(dx*dx')/dgdx - (dx*Hdg'+Hdg*dx')/dgdx;
|
||
|
0018 <span class="keyword">else</span>
|
||
|
0019 disp(<span class="string">'bfgs update failed.'</span>)
|
||
|
0020 disp([<span class="string">'|dg| = '</span> num2str(sqrt(dg'*dg)) <span class="string">'|dx| = '</span> num2str(sqrt(dx'*dx))]);
|
||
|
0021 disp([<span class="string">'dg''*dx = '</span> num2str(dgdx)])
|
||
|
0022 disp([<span class="string">'|H*dg| = '</span> num2str(Hdg'*Hdg)])
|
||
|
0023 H=H0;
|
||
|
0024 <span class="keyword">end</span>
|
||
|
0025 save H.dat H</pre></div>
|
||
|
<hr><address>Generated on Fri 16-Jun-2006 09:09:06 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address>
|
||
|
</body>
|
||
|
</html>
|