<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:space="preserve"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/><title>F08XEF (DHGEQZ) : NAG Library, Mark 23</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a class="rout" href="../../pdf/F08/f08xef.pdf">F08XEF (DHGEQZ) (PDF version)</a></div><div><a class="chap" href="f08conts.xml">F08 Chapter Contents</a></div><div><a class="chapint" href="f08intro.xml">F08 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library Routine Document<br/><br/>F08XEF (DHGEQZ)</h1><div class="paramtext"><div class="header"><b>Note:</b>&#160; before using this routine, please read the Users' Note for your implementation to check the interpretation of <span class="bitalic">bold italicised</span> terms and other implementation-dependent details.</div></div> 
<div class="htmltoc">
<h2 class="htmltoc"><span class="htmltochead" onclick="showLevel('htmltoc');"><span class="htmltocplus" id="htmltocplus">+</span><span class="htmltocminus" id="htmltocminus">&#8722;</span></span>&#160;Contents</h2>
<div class="htmltocitem" id="htmltoc">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#purpose">1&#160;&#160;<b>Purpose</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#specification">2&#160;&#160;<b>Specification</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">3&#160;&#160;<b>Description</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">4&#160;&#160;<b>References</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">5&#160;&#160;<b>Parameters</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">6&#160;&#160;<b>Error Indicators and Warnings</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">7&#160;&#160;<b>Accuracy</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments">8&#160;&#160;<b>Further Comments</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocexample');"><span class="htmltocplus" id="tocexampleplus">+</span><span class="htmltocminus" id="tocexampleminus">&#8722;</span></span>
<a class="htmltoc" href="#example">9&#160;&#160;<b>Example</b></a>
<div class="htmltocitem" id="tocexample">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examtext">9.1&#160;&#160;<b>Program Text</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">9.2&#160;&#160;<b>Program Data</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">9.3&#160;&#160;<b>Program Results</b></a>
</div>
</div>
</div>
</div>
</div><h2 class="standard"><a class="sec" name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2>
<div class="paramtext">F08XEF (DHGEQZ) implements the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;method for finding generalized eigenvalues of the real matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;of order <m:math><m:mi>n</m:mi></m:math>, which is in the generalized upper Hessenberg form.</div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2><table class="fspec"><tr><td class="tdfspec1">
<div class="left-tablediv"><table class="fspec1"><tbody>
<tr>
<td class="tdfspec1" valign="top" align="left">SUBROUTINE&#160;F08XEF&#160;(</td>
<td class="tdfspec2" valign="top" align="left"><a class="arg" href="#JOB">JOB</a>, <a class="arg" href="#COMPQ">COMPQ</a>, <a class="arg" href="#COMPZ">COMPZ</a>, <a class="arg" href="#N">N</a>, <a class="arg" href="#ILO">ILO</a>, <a class="arg" href="#IHI">IHI</a>, <a class="arg" href="#A">A</a>, <a class="arg" href="#LDA">LDA</a>, <a class="arg" href="#B">B</a>, <a class="arg" href="#LDB">LDB</a>, <a class="arg" href="#ALPHAR">ALPHAR</a>, <a class="arg" href="#ALPHAI">ALPHAI</a>, <a class="arg" href="#BETA">BETA</a>, <a class="arg" href="#Q">Q</a>, <a class="arg" href="#LDQ">LDQ</a>, <a class="arg" href="#Z">Z</a>, <a class="arg" href="#LDZ">LDZ</a>, <a class="arg" href="#WORK">WORK</a>, <a class="arg" href="#LWORK">LWORK</a>, <a class="arg" href="#INFO">INFO</a>)</td>
</tr>
</tbody>
</table></div>
<div class="left-tablediv"><table class="fspec3"><tbody>
<tr>
<td class="tdfspec1" valign="top" align="left">INTEGER&#160;</td>
<td class="tdfspec2" valign="top" align="left">N, ILO, IHI, LDA, LDB, LDQ, LDZ, LWORK, INFO</td>
</tr>
<tr>
<td class="tdfspec1" valign="top" align="left">REAL&#160;(KIND=nag_wp)&#160;</td>
<td class="tdfspec2" valign="top" align="left">A(LDA,*), B(LDB,*), ALPHAR(N), ALPHAI(N), BETA(N), Q(LDQ,*), Z(LDZ,*), WORK(max(1,LWORK))</td>
</tr><tr>
<td class="tdfspec1" valign="top" align="left">CHARACTER(1)&#160;</td>
<td class="tdfspec2" valign="top" align="left">JOB, COMPQ, COMPZ</td></tr></tbody>
</table></div>
</td></tr></table>
<div class="paramtext">The routine may be called by its 
    LAPACK
    name <span class="bitalic">dhgeqz</span>.</div><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">F08XEF (DHGEQZ) implements a single-double-shift version of the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;method for finding the generalized eigenvalues of the real matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;which is in the generalized upper Hessenberg form.  If the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;is not in the generalized upper Hessenberg form, then the routine <a class="rout" href="../F08/f08wef.xml">F08WEF (DGGHRD)</a> should be called before invoking F08XEF (DHGEQZ).</div><div class="paramtext">This problem is mathematically equivalent to solving the equation

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mrow><m:mi>det</m:mi><m:mfenced separators=""><m:mi>A</m:mi><m:mo>-</m:mo><m:mi>&#955;</m:mi><m:mi>B</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>0</m:mn><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><div class="paramtext">Note that, to avoid underflow, overflow and other arithmetic problems, the generalized eigenvalues <m:math><m:msub><m:mi>&#955;</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;are never computed explicitly by this routine but defined as ratios between two computed values, <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>&#946;</m:mi><m:mi>j</m:mi></m:msub></m:math>:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:msub><m:mi>&#955;</m:mi><m:mi>j</m:mi></m:msub><m:mo>=</m:mo><m:msub><m:mi>&#945;</m:mi><m:mi>j</m:mi></m:msub><m:mo>/</m:mo><m:msub><m:mi>&#946;</m:mi><m:mi>j</m:mi></m:msub><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><div class="paramtext">The parameters <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>j</m:mi></m:msub></m:math>, in general, are finite complex values and <m:math><m:msub><m:mi>&#946;</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;are finite real non-negative values.</div><div class="paramtext">If desired, the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;may be reduced to generalized Schur form.  That is, the transformed matrix <m:math><m:mi>B</m:mi></m:math>&#160;is upper triangular and the transformed matrix <m:math><m:mi>A</m:mi></m:math>&#160;is block upper triangular, where the diagonal blocks are either <m:math><m:mn>1</m:mn></m:math>&#160;by <m:math><m:mn>1</m:mn></m:math>&#160;or <m:math><m:mn>2</m:mn></m:math>&#160;by <m:math><m:mn>2</m:mn></m:math>.  The <m:math><m:mn>1</m:mn></m:math>&#160;by <m:math><m:mn>1</m:mn></m:math>&#160;blocks provide generalized eigenvalues which are real and the <m:math><m:mn>2</m:mn></m:math>&#160;by <m:math><m:mn>2</m:mn></m:math>&#160;blocks give complex generalized eigenvalues.</div><div class="paramtext">The parameter <a class="arg" href="#JOB">JOB</a> specifies two options.  If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>&#160;then the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;is simultaneously reduced to Schur form by applying one orthogonal transformation (usually called <m:math><m:mi>Q</m:mi></m:math>) on the left and another (usually called <m:math><m:mi>Z</m:mi></m:math>) on the right.  That is,

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mtable>
 <m:mtr>
  <m:mtd><m:mi>A</m:mi><m:mo>&#8592;</m:mo><m:msup><m:mi>Q</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>A</m:mi><m:mi>Z</m:mi></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd><m:mi>B</m:mi><m:mo>&#8592;</m:mo><m:msup><m:mi>Q</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>B</m:mi><m:mi>Z</m:mi></m:mtd>
 </m:mtr>
</m:mtable>
</m:math></td><td class="formula2"/></tr></table></div>

The <m:math><m:mn>2</m:mn></m:math>&#160;by <m:math><m:mn>2</m:mn></m:math>&#160;upper-triangular diagonal blocks of <m:math><m:mi>B</m:mi></m:math>&#160;corresponding to <m:math><m:mn>2</m:mn></m:math>&#160;by <m:math><m:mn>2</m:mn></m:math>&#160;blocks of <a class="arg" href="#A">A</a> will be reduced to non-negative diagonal matrices.  That is, if <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#A"><m:mi mathcolor="#EE0000" mathvariant="bold">A</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;is nonzero, then <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#B"><m:mi mathcolor="#EE0000" mathvariant="bold">B</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow><m:mi>j</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#B"><m:mi mathcolor="#EE0000" mathvariant="bold">B</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;and <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#B"><m:mi mathcolor="#EE0000" mathvariant="bold">B</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;and <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#B"><m:mi mathcolor="#EE0000" mathvariant="bold">B</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow><m:mrow><m:mi>j</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:mfenced></m:mrow></m:math>&#160;will be non-negative.</div><div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'E'</m:mtext></m:math>, then at each iteration the same transformations are computed but they are only applied to those parts of <m:math><m:mi>A</m:mi></m:math>&#160;and <m:math><m:mi>B</m:mi></m:math>&#160;which are needed to compute <m:math><m:mi>&#945;</m:mi></m:math>&#160;and <m:math><m:mi>&#946;</m:mi></m:math>.  This option could be used if generalized eigenvalues are required but not generalized eigenvectors.</div><div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>&#160;and <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>, and <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>, then the orthogonal transformations used to reduce the pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;are accumulated into the input arrays <a class="arg" href="#Q">Q</a> and <a class="arg" href="#Z">Z</a>.  If generalized eigenvectors are required then <a class="arg" href="#JOB">JOB</a> must be set to <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>&#160;and if left (right) generalized eigenvectors are to be computed then <a class="arg" href="#COMPQ">COMPQ</a> (<a class="arg" href="#COMPZ">COMPZ</a>) must be set to <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>&#160;and not <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>&#8800;</m:mo><m:mtext>'N'</m:mtext></m:math>.</div><div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math>, then eigenvectors are accumulated on the identity matrix and on exit the array <a class="arg" href="#Q">Q</a> contains the left eigenvector matrix <m:math><m:mi>Q</m:mi></m:math>.  However, if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;then the transformations are accumulated on the user-supplied matrix <m:math><m:msub><m:mi>Q</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;in array <a class="arg" href="#Q">Q</a> on entry and thus on exit <a class="arg" href="#Q">Q</a> contains the matrix product <m:math><m:mi>Q</m:mi><m:msub><m:mi>Q</m:mi><m:mn>0</m:mn></m:msub></m:math>.  A similar convention is used for <a class="arg" href="#COMPZ">COMPZ</a>.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref562" id="ref562"/>Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999)  <i>LAPACK Users' Guide</i> (3rd Edition) SIAM, Philadelphia </div>
<div class="paramtext"><a name="ref105" id="ref105"/>Golub G H and Van Loan C F (1996)  <i>Matrix Computations</i> (3rd Edition) Johns Hopkins University Press, Baltimore </div>
<div class="paramtext"><a name="ref107" id="ref107"/>Moler C B and Stewart G W (1973)  An algorithm for generalized matrix eigenproblems <i>SIAM J. Numer. Anal.</i> <b>10</b> 241&#8211;256 </div>
<div class="paramtext"><a name="ref612" id="ref612"/>Stewart G W and Sun J-G (1990)  <i>Matrix Perturbation Theory</i> Academic Press, London </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="JOB" id="JOB"/>1: &#160;&#160;&#8194; JOB &#8211; CHARACTER(1)<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: specifies the operations to be performed on <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>.

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'E'</m:mtext></m:math></dt>
<dd>The matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;on exit might not be in the generalized Schur form.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math></dt>
<dd>The matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;on exit will be in the generalized Schur form.</dd></dl>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'E'</m:mtext></m:math>&#160;or <m:math><m:mtext>'S'</m:mtext></m:math>.
</div>
</dd><dt class="paramhead"><a name="COMPQ" id="COMPQ"/>2: &#160;&#160;&#8194; COMPQ &#8211; CHARACTER(1)<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: specifies the operations to be performed on <m:math><m:mi>Q</m:mi></m:math>:

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math></dt>
<dd>The array <a class="arg" href="#Q">Q</a> is unchanged.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math></dt>
<dd>The left transformation <m:math><m:mi>Q</m:mi></m:math>&#160;is accumulated on the array <a class="arg" href="#Q">Q</a>.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math></dt>
<dd>The array <a class="arg" href="#Q">Q</a> is initialized to the identity matrix before the left transformation <m:math><m:mi>Q</m:mi></m:math>&#160;is accumulated in <a class="arg" href="#Q">Q</a>.</dd></dl>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, <m:math><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>.
</div>
</dd><dt class="paramhead"><a name="COMPZ" id="COMPZ"/>3: &#160;&#160;&#8194; COMPZ &#8211; CHARACTER(1)<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: specifies the operations to be performed on <m:math><m:mi>Z</m:mi></m:math>.

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math></dt>
<dd>The array <a class="arg" href="#Z">Z</a> is unchanged.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math></dt>
<dd>The right transformation <m:math><m:mi>Z</m:mi></m:math>&#160;is accumulated on the array <a class="arg" href="#Z">Z</a>.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math></dt>
<dd>The array <a class="arg" href="#Z">Z</a> is initialized to the identity matrix before the right transformation <m:math><m:mi>Z</m:mi></m:math>&#160;is accumulated in <a class="arg" href="#Z">Z</a>.</dd></dl>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, <m:math><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>.
</div>
</dd><dt class="paramhead"><a name="N" id="N"/>4: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: 

<m:math><m:mi>n</m:mi></m:math>, the order of the matrices <m:math><m:mi>A</m:mi></m:math>, <m:math><m:mi>B</m:mi></m:math>, <m:math><m:mi>Q</m:mi></m:math>&#160;and <m:math><m:mi>Z</m:mi></m:math>.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>0</m:mn></m:math>.
</div>
</dd><dt class="paramhead"><a name="ILO" id="ILO"/>5: &#160;&#160;&#8194; ILO &#8211; INTEGER<span class="pclass">Input</span></dt><dt class="multi-paramhead"><a name="IHI" id="IHI"/>6: &#160;&#160;&#8194; IHI &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the indices <m:math><m:msub><m:mi>i</m:mi><m:mi mathvariant="normal">lo</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>i</m:mi><m:mi mathvariant="normal">hi</m:mi></m:msub></m:math>, respectively which define the upper triangular parts of <m:math><m:mi>A</m:mi></m:math>. The submatrices <m:math><m:mi>A</m:mi><m:mfenced separators=""><m:mrow><m:mn>1</m:mn><m:mo>:</m:mo><m:msub><m:mi>i</m:mi><m:mi mathvariant="normal">lo</m:mi></m:msub><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mo>,</m:mo><m:mrow><m:mn>1</m:mn><m:mo>:</m:mo><m:msub><m:mi>i</m:mi><m:mi mathvariant="normal">lo</m:mi></m:msub><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:mfenced></m:math>&#160;and <m:math><m:mi>A</m:mi><m:mfenced separators=""><m:mrow><m:msub><m:mi>i</m:mi><m:mi mathvariant="normal">hi</m:mi></m:msub><m:mo>+</m:mo><m:mn>1</m:mn><m:mo>:</m:mo><m:mi>n</m:mi></m:mrow><m:mo>,</m:mo><m:mrow><m:msub><m:mi>i</m:mi><m:mi mathvariant="normal">hi</m:mi></m:msub><m:mo>+</m:mo><m:mn>1</m:mn><m:mo>:</m:mo><m:mi>n</m:mi></m:mrow></m:mfenced></m:math>&#160;are then upper triangular. These parameters are provided by
<a class="rout" href="../F08/f08whf.xml">F08WHF (DGGBAL)</a>
if the matrix pair was previously balanced; otherwise, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#ILO"><m:mi mathcolor="#EE0000" mathvariant="bold">ILO</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;and <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IHI"><m:mi mathcolor="#EE0000" mathvariant="bold">IHI</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>.</div><div class="paramtext"><i>Constraints</i>:
   <div class="paramtext"/><ul class="listcons">
<li class="listcons">if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:math>, <m:math><m:mn>1</m:mn><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#ILO"><m:mi mathcolor="#EE0000" mathvariant="bold">ILO</m:mi></m:maction><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#IHI"><m:mi mathcolor="#EE0000" mathvariant="bold">IHI</m:mi></m:maction><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>;</li>
<li class="listcons">if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#ILO"><m:mi mathcolor="#EE0000" mathvariant="bold">ILO</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;and <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IHI"><m:mi mathcolor="#EE0000" mathvariant="bold">IHI</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>.</li>
</ul></div>
</dd><dt class="paramhead"><a name="A" id="A"/>7: &#160;&#160;&#8194; A(<a class="arg" href="#LDA">LDA</a>,<m:math><m:mo>*</m:mo></m:math>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> the second dimension of the array <a class="arg" href="#A">A</a>
must be at least
<m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>.</div>
<div class="paramtext"><i>On entry</i>: the <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;upper Hessenberg matrix <m:math><m:mi>A</m:mi></m:math>. The elements below the first subdiagonal must be set to zero.</div>
<div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>, the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;will be simultaneously reduced to generalized Schur form.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'E'</m:mtext></m:math>, the <m:math><m:mn>1</m:mn></m:math>&#160;by <m:math><m:mn>1</m:mn></m:math>&#160;and <m:math><m:mn>2</m:mn></m:math>&#160;by <m:math><m:mn>2</m:mn></m:math>&#160;diagonal blocks of the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;will give generalized eigenvalues but the remaining elements will be irrelevant.</div>
</div></dd><dt class="paramhead"><a name="LDA" id="LDA"/>8: &#160;&#160;&#8194; LDA &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the first dimension of the array <a class="arg" href="#A">A</a> as declared in the (sub)program from which F08XEF (DHGEQZ) is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDA"><m:mi mathcolor="#EE0000" mathvariant="bold">LDA</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>.
</div>
</dd><dt class="paramhead"><a name="B" id="B"/>9: &#160;&#160;&#8194; B(<a class="arg" href="#LDB">LDB</a>,<m:math><m:mo>*</m:mo></m:math>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> the second dimension of the array <a class="arg" href="#B">B</a>
must be at least
<m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>.</div>
<div class="paramtext"><i>On entry</i>: the <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;upper triangular matrix <m:math><m:mi>B</m:mi></m:math>. The elements below the diagonal must be zero.</div>
<div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>, the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;will be simultaneously reduced to generalized Schur form.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#JOB"><m:mi mathcolor="#EE0000" mathvariant="bold">JOB</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'E'</m:mtext></m:math>, the <m:math><m:mn>1</m:mn></m:math>&#160;by <m:math><m:mn>1</m:mn></m:math>&#160;and <m:math><m:mn>2</m:mn></m:math>&#160;by <m:math><m:mn>2</m:mn></m:math>&#160;diagonal blocks of the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;will give generalized eigenvalues but the remaining elements will be irrelevant.</div>
</div></dd><dt class="paramhead"><a name="LDB" id="LDB"/>10: &#8194; LDB &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the first dimension of the array <a class="arg" href="#B">B</a> as declared in the (sub)program from which F08XEF (DHGEQZ) is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDB"><m:mi mathcolor="#EE0000" mathvariant="bold">LDB</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>.
</div>
</dd><dt class="paramhead"><a name="ALPHAR" id="ALPHAR"/>11: &#8194; ALPHAR(<a class="arg" href="#N">N</a>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the real parts of <m:math><m:msub><m:mi>&#945;</m:mi><m:mi mathvariant="italic">j</m:mi></m:msub></m:math>, for <m:math><m:mi mathvariant="italic">j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div>
</dd><dt class="paramhead"><a name="ALPHAI" id="ALPHAI"/>12: &#8194; ALPHAI(<a class="arg" href="#N">N</a>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the imaginary parts of <m:math><m:msub><m:mi>&#945;</m:mi><m:mi mathvariant="italic">j</m:mi></m:msub></m:math>, for <m:math><m:mi mathvariant="italic">j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div>
</dd><dt class="paramhead"><a name="BETA" id="BETA"/>13: &#8194; BETA(<a class="arg" href="#N">N</a>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: <m:math><m:msub><m:mi>&#946;</m:mi><m:mi mathvariant="italic">j</m:mi></m:msub></m:math>, for <m:math><m:mi mathvariant="italic">j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div>
</dd><dt class="paramhead"><a name="Q" id="Q"/>14: &#8194; Q(<a class="arg" href="#LDQ">LDQ</a>,<m:math><m:mo>*</m:mo></m:math>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> the second dimension of the array <a class="arg" href="#Q">Q</a>
must be at least
<m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>&#160;and at least <m:math><m:mn>1</m:mn></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>.</div>
<div class="paramtext"><i>On entry</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>, the matrix <m:math><m:msub><m:mi>Q</m:mi><m:mn>0</m:mn></m:msub></m:math>. The matrix <m:math><m:msub><m:mi>Q</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;is usually the matrix <m:math><m:mi>Q</m:mi></m:math>&#160;returned by <a class="rout" href="../F08/f08wef.xml">F08WEF (DGGHRD)</a>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, <a class="arg" href="#Q">Q</a> is not referenced.</div></div>
<div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>, <a class="arg" href="#Q">Q</a> contains the matrix product <m:math><m:mi>Q</m:mi><m:msub><m:mi>Q</m:mi><m:mn>0</m:mn></m:msub></m:math>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math>, <a class="arg" href="#Q">Q</a> contains the transformation matrix <m:math><m:mi>Q</m:mi></m:math>.</div>
</div>
</dd><dt class="paramhead"><a name="LDQ" id="LDQ"/>15: &#8194; LDQ &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the first dimension of the array <a class="arg" href="#Q">Q</a> as declared in the (sub)program from which F08XEF (DHGEQZ) is called.</div><div class="paramtext"><i>Constraints</i>:
   <div class="paramtext"/><ul class="listcons">
<li class="listcons">if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDQ"><m:mi mathcolor="#EE0000" mathvariant="bold">LDQ</m:mi></m:maction><m:mo>&#8805;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>;</li>
<li class="listcons">if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPQ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPQ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDQ"><m:mi mathcolor="#EE0000" mathvariant="bold">LDQ</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>.</li>
</ul></div>
</dd><dt class="paramhead"><a name="Z" id="Z"/>16: &#8194; Z(<a class="arg" href="#LDZ">LDZ</a>,<m:math><m:mo>*</m:mo></m:math>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> the second dimension of the array <a class="arg" href="#Z">Z</a>
must be at least
<m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>&#160;and at least <m:math><m:mn>1</m:mn></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>.</div>
<div class="paramtext"><i>On entry</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>, the matrix <m:math><m:msub><m:mi>Z</m:mi><m:mn>0</m:mn></m:msub></m:math>. The matrix <m:math><m:msub><m:mi>Z</m:mi><m:mn>0</m:mn></m:msub></m:math>&#160;is usually the matrix <m:math><m:mi>Z</m:mi></m:math>&#160;returned by <a class="rout" href="../F08/f08wef.xml">F08WEF (DGGHRD)</a>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, <a class="arg" href="#Z">Z</a> is not referenced.</div>
</div>
<div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>, <a class="arg" href="#Z">Z</a> contains the matrix product <m:math><m:mi>Z</m:mi><m:msub><m:mi>Z</m:mi><m:mn>0</m:mn></m:msub></m:math>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math>, <a class="arg" href="#Z">Z</a> contains the transformation matrix <m:math><m:mi>Z</m:mi></m:math>.</div>
</div>
</dd><dt class="paramhead"><a name="LDZ" id="LDZ"/>17: &#8194; LDZ &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the first dimension of the array <a class="arg" href="#Z">Z</a> as declared in the (sub)program from which F08XEF (DHGEQZ) is called.</div><div class="paramtext"><i>Constraints</i>:
   <div class="paramtext"/><ul class="listcons">
<li class="listcons">if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'V'</m:mtext></m:math>&#160;or <m:math><m:mtext>'I'</m:mtext></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDZ"><m:mi mathcolor="#EE0000" mathvariant="bold">LDZ</m:mi></m:maction><m:mo>&#8805;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>;</li>
<li class="listcons">if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#COMPZ"><m:mi mathcolor="#EE0000" mathvariant="bold">COMPZ</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDZ"><m:mi mathcolor="#EE0000" mathvariant="bold">LDZ</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>.</li>
</ul></div>
</dd><dt class="paramhead"><a name="WORK" id="WORK"/>18: &#8194; WORK(<m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#LWORK"><m:mi mathcolor="#EE0000" mathvariant="bold">LWORK</m:mi></m:maction></m:mfenced></m:mrow></m:math>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Workspace</span></dt><dd><div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#WORK"><m:mi mathcolor="#EE0000" mathvariant="bold">WORK</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>&#160;contains the minimum value of <a class="arg" href="#LWORK">LWORK</a> required for optimal performance.</div>
</dd><dt class="paramhead"><a name="LWORK" id="LWORK"/>19: &#8194; LWORK &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: 
the dimension of the array <a class="arg" href="#WORK">WORK</a> as declared in the (sub)program from which F08XEF (DHGEQZ) is called.


<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LWORK"><m:mi mathcolor="#EE0000" mathvariant="bold">LWORK</m:mi></m:maction><m:mo>=</m:mo><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>, a workspace query is assumed; the routine only calculates the minimum size of the <a class="arg" href="#WORK">WORK</a> array, returns this value as the first entry of the <a class="arg" href="#WORK">WORK</a> array, and no error message related to <a class="arg" href="#LWORK">LWORK</a> is issued.</div></div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LWORK"><m:mi mathcolor="#EE0000" mathvariant="bold">LWORK</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LWORK"><m:mi mathcolor="#EE0000" mathvariant="bold">LWORK</m:mi></m:maction><m:mo>=</m:mo><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:math>.
</div>
</dd><dt class="paramhead"><a name="INFO" id="INFO"/>20: &#8194; INFO &#8211; INTEGER<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;unless the routine detects an error (see <a class="sec" href="#errors">Section 6</a>).</div></dd></dl><h2 class="standard"><a class="sec" name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>
<div class="paramtext">Errors or warnings detected by the routine:</div>
<dl class="ifail">
<dt class="errorhead"><a name="INlt0" id="INlt0"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math></dt>
<dd><div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>=</m:mo><m:mo>-</m:mo><m:mi>i</m:mi></m:math>, argument <m:math><m:mi>i</m:mi></m:math>&#160;had an illegal value. An explanatory message is output, and execution of the program is terminated.</div></dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="INgt0" id="INgt0"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:math></dt>
<dd><div class="paramtext">If <m:math><m:mn>1</m:mn><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>, the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;iteration did not converge and the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;is not in the generalized Schur form at exit.  However, if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>, then the computed <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>&#946;</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;should be correct for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>+</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>.</div>
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>+</m:mo><m:mn>1</m:mn><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>2</m:mn><m:mo>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>, the computation of shifts failed and the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;is not in the generalized Schur form at exit.  However, if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>2</m:mn><m:mo>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>, then the computed <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>&#946;</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;should be correct for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>-</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>+</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>.</div>
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#INFO"><m:mi mathcolor="#EE0000" mathvariant="bold">INFO</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>2</m:mn><m:mo>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>, then an unexpected
Library error has occurred.  Please contact <a class="url" href="http://www.nag.co.uk">NAG</a> with details of your program.</div></dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">Please consult Section 4.11 of the LAPACK Users' Guide (see <a class="ref" href="#ref562">Anderson <span class="italic">et al.</span> (1999)</a>) and Chapter 6 of <a class="ref" href="#ref612">Stewart and Sun (1990)</a>, for more information.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">F08XEF (DHGEQZ) is the fifth step in the solution of the real generalized eigenvalue problem and is called after <a class="rout" href="../F08/f08wef.xml">F08WEF (DGGHRD)</a>.</div><div class="paramtext">The complex analogue of this routine is <a class="rout" href="../F08/f08xsf.xml">F08XSF (ZHGEQZ)</a>.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example computes the <m:math><m:mi>&#945;</m:mi></m:math>&#160;and <m:math><m:mi>&#946;</m:mi></m:math>&#160;parameters, which defines the generalized eigenvalues, of the matrix pair <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>,</m:mo><m:mi>B</m:mi></m:mfenced></m:math>&#160;given by

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>A</m:mi>
 <m:mo>=</m:mo>
 <m:mfenced><m:mtable columnalign="right">
<m:mtr>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>2.0</m:mn></m:mtd>
   <m:mtd><m:mn>4.0</m:mn></m:mtd>
   <m:mtd><m:mn>8.0</m:mn></m:mtd>
   <m:mtd><m:mn>16.0</m:mn></m:mtd>
   <m:mtd><m:mn>32.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>3.0</m:mn></m:mtd>
   <m:mtd><m:mn>9.0</m:mn></m:mtd>
   <m:mtd><m:mn>27.0</m:mn></m:mtd>
   <m:mtd><m:mn>81.0</m:mn></m:mtd>
   <m:mtd><m:mn>243.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>4.0</m:mn></m:mtd>
   <m:mtd><m:mn>16.0</m:mn></m:mtd>
   <m:mtd><m:mn>64.0</m:mn></m:mtd>
   <m:mtd><m:mn>256.0</m:mn></m:mtd>
   <m:mtd><m:mn>1024.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>5.0</m:mn></m:mtd>
   <m:mtd><m:mn>25.0</m:mn></m:mtd>
   <m:mtd><m:mn>125.0</m:mn></m:mtd>
   <m:mtd><m:mn>625.0</m:mn></m:mtd>
   <m:mtd><m:mn>3125.0</m:mn></m:mtd>
</m:mtr>
</m:mtable></m:mfenced>
</m:math></td><td class="formula2"/></tr></table></div><div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>B</m:mi>
 <m:mo>=</m:mo>
 <m:mfenced><m:mtable columnalign="right">
<m:mtr>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>2.0</m:mn></m:mtd>
   <m:mtd><m:mn>3.0</m:mn></m:mtd>
   <m:mtd><m:mn>4.0</m:mn></m:mtd>
   <m:mtd><m:mn>5.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>4.0</m:mn></m:mtd>
   <m:mtd><m:mn>9.0</m:mn></m:mtd>
   <m:mtd><m:mn>16.0</m:mn></m:mtd>
   <m:mtd><m:mn>25.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>8.0</m:mn></m:mtd>
   <m:mtd><m:mn>27.0</m:mn></m:mtd>
   <m:mtd><m:mn>64.0</m:mn></m:mtd>
   <m:mtd><m:mn>125.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>16.0</m:mn></m:mtd>
   <m:mtd><m:mn>81.0</m:mn></m:mtd>
   <m:mtd><m:mn>256.0</m:mn></m:mtd>
   <m:mtd><m:mn>625.0</m:mn></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>1.0</m:mn></m:mtd>
   <m:mtd><m:mn>32.0</m:mn></m:mtd>
   <m:mtd><m:mn>243.0</m:mn></m:mtd>
   <m:mtd><m:mn>1024.0</m:mn></m:mtd>
   <m:mtd><m:mn>3125.0</m:mn></m:mtd>
</m:mtr>
</m:mtable></m:mfenced>
<m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

This requires calls to five routines: <a class="rout" href="../F08/f08whf.xml">F08WHF (DGGBAL)</a> to balance the matrix, <a class="rout" href="../F08/f08aef.xml">F08AEF (DGEQRF)</a> to perform the <m:math><m:mi>Q</m:mi><m:mi>R</m:mi></m:math>&#160;factorization of <m:math><m:mi>B</m:mi></m:math>, <a class="rout" href="../F08/f08agf.xml">F08AGF (DORMQR)</a> to apply <m:math><m:mi>Q</m:mi></m:math>&#160;to <m:math><m:mi>A</m:mi></m:math>, <a class="rout" href="../F08/f08wef.xml">F08WEF (DGGHRD)</a> to reduce the matrix pair to the generalized Hessenberg form and F08XEF (DHGEQZ) to compute the eigenvalues using the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;algorithm.</div><h3 class="standard"><a class="sec" name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
<p><a class="verbatimref" href="../../examples/source/f08xefe.f90">Program Text (f08xefe.f90)</a></p><h3 class="standard"><a class="sec" name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>
<p><a class="verbatimref" href="../../examples/data/f08xefe.d">Program&#160;Data (f08xefe.d)</a></p><h3 class="standard"><a class="sec" name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>
<p><a class="verbatimref" href="../../examples/baseresults/f08xefe.r">Program Results (f08xefe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/F08/f08xef.pdf">F08XEF (DHGEQZ) (PDF version)</a></div><div><a class="chap" href="f08conts.xml">F08 Chapter Contents</a></div><div><a class="chapint" href="f08intro.xml">F08 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div>
<div><hr/><a class="genint" href="../FRONTMATTER/copyright.xml">&#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2011</a></div></body></html>