dynare/matlab/doc/qzdiv.html

81 lines
4.3 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 qzdiv</title>
<meta name="keywords" content="qzdiv">
<meta name="description" content="from Chris Sims web site">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html &copy; 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> &gt; <a href="index.html">.</a> &gt; qzdiv.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for .&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>qzdiv
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>from Chris Sims web site</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 [A,B,Q,Z] = qzdiv(stake,A,B,Q,Z) </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"> from Chris Sims web site
http://eco-072399b.princeton.edu/yftp/gensys/mfiles/QZDIV.M</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)">
<li><a href="qzswitch.html" class="code" title="function [A,B,Q,Z] = qzswitch(i,A,B,Q,Z)">qzswitch</a> from Chris Sims web site</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="dr1.html" class="code" title="function [dr,info]=dr1(dr,task)">dr1</a> Copyright (C) 2001 Michel Juillard</li><li><a href="dr11.html" class="code" title="function dr=dr11(iorder,dr,cheik)">dr11</a> Copyright (C) 2001 Michel Juillard</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 <span class="comment">% from Chris Sims web site</span>
0002 <span class="comment">% http://eco-072399b.princeton.edu/yftp/gensys/mfiles/QZDIV.M</span>
0003 <span class="comment">%</span>
0004
0005 <a name="_sub0" href="#_subfunctions" class="code">function [A,B,Q,Z] = qzdiv(stake,A,B,Q,Z)</a>
0006 <span class="comment">%function [A,B,Q,Z] = qzdiv(stake,A,B,Q,Z)</span>
0007 <span class="comment">%</span>
0008 <span class="comment">% Takes U.T. matrices A, B, orthonormal matrices Q,Z, rearranges them</span>
0009 <span class="comment">% so that all cases of abs(B(i,i)/A(i,i))&gt;stake are in lower right</span>
0010 <span class="comment">% corner, while preserving U.T. and orthonormal properties and Q'AZ' and</span>
0011 <span class="comment">% Q'BZ'.</span>
0012 <span class="comment">%</span>
0013 [n jnk] = size(A);
0014 root = abs([diag(A) diag(B)]);
0015 root(:,1) = root(:,1)-(root(:,1)&lt;1.e-13).*(root(:,1)+root(:,2));
0016 root(:,2) = root(:,2)./root(:,1);
0017 <span class="keyword">for</span> i = n:-1:1
0018 m=0;
0019 <span class="keyword">for</span> j=i:-1:1
0020 <span class="keyword">if</span> (root(j,2) &gt; stake | root(j,2) &lt; -.1)
0021 m=j;
0022 <span class="keyword">break</span>
0023 <span class="keyword">end</span>
0024 <span class="keyword">end</span>
0025 <span class="keyword">if</span> (m==0)
0026 <span class="keyword">return</span>
0027 <span class="keyword">end</span>
0028 <span class="keyword">for</span> k=m:1:i-1
0029 [A B Q Z] = <a href="qzswitch.html" class="code" title="function [A,B,Q,Z] = qzswitch(i,A,B,Q,Z)">qzswitch</a>(k,A,B,Q,Z);
0030 tmp = root(k,2);
0031 root(k,2) = root(k+1,2);
0032 root(k+1,2) = tmp;
0033 <span class="keyword">end</span>
0034 <span class="keyword">end</span></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> &copy; 2003</address>
</body>
</html>