<?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>F02GJF : NAG Library, Mark 22</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/F02/f02gjf.pdf">F02GJF (PDF version)</a></div><div><a class="chap" href="f02conts.xml">F02 Chapter Contents</a></div><div><a class="chapint" href="f02intro.xml">F02 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/>F02GJF</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">F02GJF calculates all the eigenvalues and, if required,  all the eigenvectors of the complex generalized eigenproblem  <m:math><m:mi>A</m:mi><m:mi>x</m:mi><m:mo>=</m:mo><m:mi>&#955;</m:mi><m:mi>B</m:mi><m:mi>x</m:mi></m:math>&#160;where <m:math><m:mi>A</m:mi></m:math>&#160;and <m:math><m:mi>B</m:mi></m:math>&#160;are complex, square matrices, using the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;algorithm.</div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;F02GJF&#160;(</td><td class="tdfspec2"><a class="arg" href="#N">N</a>, <a class="arg" href="#AR">AR</a>, <a class="arg" href="#LDAR">LDAR</a>, <a class="arg" href="#AI">AI</a>, <a class="arg" href="#LDAI">LDAI</a>, <a class="arg" href="#BR">BR</a>, <a class="arg" href="#LDBR">LDBR</a>, <a class="arg" href="#BI">BI</a>, <a class="arg" href="#LDBI">LDBI</a>, <a class="arg" href="#EPS1">EPS1</a>, <a class="arg" href="#ALFR">ALFR</a>, <a class="arg" href="#ALFI">ALFI</a>, <a class="arg" href="#BETA">BETA</a>, <a class="arg" href="#MATV">MATV</a>, <a class="arg" href="#VR">VR</a>, <a class="arg" href="#LDVR">LDVR</a>, <a class="arg" href="#VI">VI</a>, <a class="arg" href="#LDVI">LDVI</a>, <a class="arg" href="#ITER">ITER</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, LDAR, LDAI, LDBR, LDBI, LDVR, LDVI, ITER(N), IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">AR(LDAR,N), AI(LDAI,N), BR(LDBR,N), BI(LDBI,N), EPS1, ALFR(N), ALFI(N), BETA(N), VR(LDVR,N), VI(LDVI,N)</td></tr><tr><td class="tdfspec1">LOGICAL</td><td class="tdfspec2">MATV</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">All the eigenvalues and, if required, all the eigenvectors of the complex generalized eigenproblem <m:math><m:mi>A</m:mi><m:mi>x</m:mi><m:mo>=</m:mo><m:mi>&#955;</m:mi><m:mi>B</m:mi><m:mi>x</m:mi></m:math>&#160;where  <m:math><m:mi>A</m:mi></m:math>&#160;and <m:math><m:mi>B</m:mi></m:math>&#160;are complex, square matrices,  are determined using the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;algorithm.  The complex  <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;algorithm consists of three stages:
<ol class="listnumber"><li class="listnumber"><m:math><m:mi>A</m:mi></m:math>&#160;is reduced to upper Hessenberg form (with real, non-negative subdiagonal elements) and at the same time <m:math><m:mi>B</m:mi></m:math>&#160;is reduced to upper triangular form.</li><li class="listnumber"><m:math><m:mi>A</m:mi></m:math>&#160;is further reduced to triangular form while the triangular form of <m:math><m:mi>B</m:mi></m:math>&#160;is maintained and the diagonal elements of  <m:math><m:mi>B</m:mi></m:math>&#160;are made real and non-negative.
 <div class="paramtext">F02GJF does not actually produce the eigenvalues  <m:math><m:msub><m:mi>&#955;</m:mi><m:mi>j</m:mi></m:msub></m:math>, but instead returns <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>&#160;such that

<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>, &#8195;</m:mtext><m:mi>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:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

The division by <m:math><m:msub><m:mi>&#946;</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;becomes the responsibility of your program, since <m:math><m:msub><m:mi>&#946;</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;may be zero, indicating an infinite eigenvalue.</div></li><li class="listnumber">If the eigenvectors are required (<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MATV"><m:mi mathcolor="#EE0000" mathvariant="bold">MATV</m:mi></m:maction><m:mo>=</m:mo><m:mi mathvariant="normal">.TRUE.</m:mi></m:math>), they are obtained from the triangular matrices and then transferred back into the original co-ordinate system.</li></ol>
</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><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="ref108" id="ref108"/>Ward R C (1975)  The combination shift <m:math><m:mrow><m:mi>Q</m:mi><m:mi>Z</m:mi></m:mrow></m:math>&#160;algorithm <i>SIAM J. Numer. Anal.</i> <b>12</b> 835&#8211;853 </div>
<div class="paramtext"><a name="ref109" id="ref109"/>Wilkinson J H (1979)  Kronecker's canonical form and the <m:math><m:mrow><m:mi>Q</m:mi><m:mi>Z</m:mi></m:mrow></m:math>&#160;algorithm <i>Linear Algebra Appl.</i> <b>28</b> 285&#8211;303 </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="N" id="N"/>1: &#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>&#160;and <m:math><m:mi>B</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>1</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="AR" id="AR"/>2: &#160;&#160;&#8194; AR(<a class="arg" href="#LDAR">LDAR</a>,<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: the real parts of the elements of the <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;complex matrix <m:math><m:mi>A</m:mi></m:math>.</div>
<div class="paramtext"><i>On exit</i>: <a class="arg" href="#AR">AR</a> is overwritten.</div></dd><dt class="paramhead"><a name="LDAR" id="LDAR"/>3: &#160;&#160;&#8194; LDAR &#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="#AR">AR</a> as declared in the (sub)program from which F02GJF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDAR"><m:mi mathcolor="#EE0000" mathvariant="bold">LDAR</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>.
</div></dd><dt class="paramhead"><a name="AI" id="AI"/>4: &#160;&#160;&#8194; AI(<a class="arg" href="#LDAI">LDAI</a>,<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: the imaginary parts of the elements of the <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;complex matrix <m:math><m:mi>A</m:mi></m:math>.</div>
<div class="paramtext"><i>On exit</i>: <a class="arg" href="#AI">AI</a> is overwritten.</div></dd><dt class="paramhead"><a name="LDAI" id="LDAI"/>5: &#160;&#160;&#8194; LDAI &#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="#AI">AI</a> as declared in the (sub)program from which F02GJF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDAI"><m:mi mathcolor="#EE0000" mathvariant="bold">LDAI</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>.
</div></dd><dt class="paramhead"><a name="BR" id="BR"/>6: &#160;&#160;&#8194; BR(<a class="arg" href="#LDBR">LDBR</a>,<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: the real parts of the elements of the <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;complex matrix <m:math><m:mi>B</m:mi></m:math>.</div>
<div class="paramtext"><i>On exit</i>: <a class="arg" href="#BR">BR</a> is overwritten.</div></dd><dt class="paramhead"><a name="LDBR" id="LDBR"/>7: &#160;&#160;&#8194; LDBR &#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="#BR">BR</a> as declared in the (sub)program from which F02GJF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDBR"><m:mi mathcolor="#EE0000" mathvariant="bold">LDBR</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>.
</div></dd><dt class="paramhead"><a name="BI" id="BI"/>8: &#160;&#160;&#8194; BI(<a class="arg" href="#LDBI">LDBI</a>,<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: the imaginary parts of the elements of the <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;complex matrix <m:math><m:mi>B</m:mi></m:math>.</div>
<div class="paramtext"><i>On exit</i>: <a class="arg" href="#BI">BI</a> is overwritten.</div></dd><dt class="paramhead"><a name="LDBI" id="LDBI"/>9: &#160;&#160;&#8194; LDBI &#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="#BI">BI</a> as declared in the (sub)program from which F02GJF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDBI"><m:mi mathcolor="#EE0000" mathvariant="bold">LDBI</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>.
</div></dd><dt class="paramhead"><a name="EPS1" id="EPS1"/>10: &#8194; EPS1 &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: a tolerance used to determine negligible elements. 

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#EPS1"><m:mi mathcolor="#EE0000" mathvariant="bold">EPS1</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>0.0</m:mn></m:math></dt>
<dd>An element will be considered negligible if it is less than <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#EPS1"><m:mi mathcolor="#EE0000" mathvariant="bold">EPS1</m:mi></m:maction><m:mo>&#215;</m:mo><m:mtext/></m:math>the norm of its matrix.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#EPS1"><m:mi mathcolor="#EE0000" mathvariant="bold">EPS1</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>0.0</m:mn></m:math></dt>
<dd><span class="bitalic">machine precision</span> is used for <a class="arg" href="#EPS1">EPS1</a>.</dd></dl>
<div class="paramtext">A positive value of <a class="arg" href="#EPS1">EPS1</a> may result in faster execution but less accurate results.</div>
</div></dd><dt class="paramhead"><a name="ALFR" id="ALFR"/>11: &#8194; ALFR(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dt class="multi-paramhead"><a name="ALFI" id="ALFI"/>12: &#8194; ALFI(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the real and imaginary parts of <m:math><m:msub><m:mi>&#945;</m:mi><m:mi>j</m:mi></m:msub></m:math>, for <m:math><m:mi>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; <span class="bitalic">double precision</span> 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>j</m:mi></m:msub></m:math>, for <m:math><m:mi>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="MATV" id="MATV"/>14: &#8194; MATV &#8211; LOGICAL<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: must be set .TRUE. if the eigenvectors are required, otherwise .FALSE..</div></dd><dt class="paramhead"><a name="VR" id="VR"/>15: &#8194; VR(<a class="arg" href="#LDVR">LDVR</a>,<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MATV"><m:mi mathcolor="#EE0000" mathvariant="bold">MATV</m:mi></m:maction><m:mo>=</m:mo><m:mi mathvariant="normal">.TRUE.</m:mi></m:math>, the <m:math><m:mi>j</m:mi></m:math>th column of <a class="arg" href="#VR">VR</a> contains the real parts of the eigenvector corresponding to the <m:math><m:mi>j</m:mi></m:math>th eigenvalue. The eigenvectors are normalized so that the sum of squares of the moduli of the components is equal to <m:math><m:mn>1.0</m:mn></m:math>&#160;and the component of largest modulus is real.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MATV"><m:mi mathcolor="#EE0000" mathvariant="bold">MATV</m:mi></m:maction><m:mo>=</m:mo><m:mi mathvariant="normal">.FALSE.</m:mi></m:math>, <a class="arg" href="#VR">VR</a> is not used.</div>
</div></dd><dt class="paramhead"><a name="LDVR" id="LDVR"/>16: &#8194; LDVR &#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="#VR">VR</a> as declared in the (sub)program from which F02GJF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDVR"><m:mi mathcolor="#EE0000" mathvariant="bold">LDVR</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>.
</div></dd><dt class="paramhead"><a name="VI" id="VI"/>17: &#8194; VI(<a class="arg" href="#LDVI">LDVI</a>,<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MATV"><m:mi mathcolor="#EE0000" mathvariant="bold">MATV</m:mi></m:maction><m:mo>=</m:mo><m:mi mathvariant="normal">.TRUE.</m:mi></m:math>, the <m:math><m:mi>j</m:mi></m:math>th column of <a class="arg" href="#VI">VI</a> contains the imaginary parts of the eigenvector corresponding to the <m:math><m:mi>j</m:mi></m:math>th eigenvalue.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MATV"><m:mi mathcolor="#EE0000" mathvariant="bold">MATV</m:mi></m:maction><m:mo>=</m:mo><m:mi mathvariant="normal">.FALSE.</m:mi></m:math>, <a class="arg" href="#VI">VI</a> is not used.</div>
</div></dd><dt class="paramhead"><a name="LDVI" id="LDVI"/>18: &#8194; LDVI &#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="#VI">VI</a> as declared in the (sub)program from which F02GJF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDVI"><m:mi mathcolor="#EE0000" mathvariant="bold">LDVI</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>.
</div></dd><dt class="paramhead"><a name="ITER" id="ITER"/>19: &#8194; ITER(<a class="arg" href="#N">N</a>) &#8211; INTEGER array<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#ITER"><m:mi mathcolor="#EE0000" mathvariant="bold">ITER</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>&#160;contains the number of iterations needed to obtain the <m:math><m:mi>j</m:mi></m:math>th eigenvalue. Note that the eigenvalues are obtained in reverse order, starting with the <m:math><m:mi>n</m:mi></m:math>th.</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>20: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: <a class="arg" href="#IFAIL">IFAIL</a> must be set to <m:math><m:mn>0</m:mn></m:math>, <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>. If you are unfamiliar with this parameter you should refer to <a class="sec" href="../GENINT/essint.xml#library3">Section 3.3</a> in  the Essential Introduction for details.</div>
<div class="paramtext"><i>On exit</i>: <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</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>&#160;unless the routine detects an error (see <a class="sec" href="#errors">Section 6</a>). <div class="paramtext">For environments where it might be inappropriate to halt program execution when an error is detected, the value <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is recommended.  If the output of error messages is undesirable, then the value <m:math><m:mn>1</m:mn></m:math>&#160;is recommended.  Otherwise, if you are not familiar with this parameter, the recommended value is <m:math><m:mn>0</m:mn></m:math>.  <b>When the value <m:math><m:mrow><m:mo>-</m:mo><m:mn mathvariant="bold">1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn mathvariant="bold">1</m:mn></m:math>&#160;is used it is essential to test the value of <a class="arg" href="#IFAIL">IFAIL</a> on exit.</b></div></div></dd></dl><h2 class="standard"><a class="sec" name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>
<div class="paramtext">If on entry <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</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>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">-1</m:mn></m:maction></m:math>, explanatory error messages are output on the current error message unit (as defined by <a class="rout" href="../X04/x04aaf.xml">X04AAF</a>).</div><div class="paramtext">Errors or warnings detected by the routine:</div>
<dl class="ifail">
<dt class="errorhead"><a name="IFeqi" id="IFeqi"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mi>i</m:mi></m:math></dt>
<dd>
<div class="paramtext">More than <m:math><m:mn>30</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>&#160;iterations have been performed altogether in the second step of the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;algorithm; <a class="arg" href="#IFAIL">IFAIL</a>  is set to the index <m:math><m:mi>i</m:mi></m:math>&#160;of the eigenvalue at which the failure occurs.  On soft failure, <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>&#160;are correct for <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mi>i</m:mi><m:mo>+</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mi>i</m:mi><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>,  but the arrays <a class="arg" href="#VR">VR</a> and <a class="arg" href="#VI">VI</a> do not contain any correct eigenvectors.</div>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">The computed eigenvalues are always exact for a problem <m:math><m:mfenced separators=""><m:mi>A</m:mi><m:mo>+</m:mo><m:mi>E</m:mi></m:mfenced><m:mi>x</m:mi><m:mo>=</m:mo><m:mi>&#955;</m:mi><m:mfenced separators=""><m:mi>B</m:mi><m:mo>+</m:mo><m:mi>F</m:mi></m:mfenced><m:mi>x</m:mi></m:math>&#160;where <m:math><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:mi>E</m:mi></m:mfenced><m:mo>/</m:mo><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:mi>A</m:mi></m:mfenced></m:math>&#160;and <m:math><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:mi>F</m:mi></m:mfenced><m:mo>/</m:mo><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:mi>B</m:mi></m:mfenced></m:math>&#160;are both of the order of  <m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:maction actiontype="link" dsi:type="simple" dsi:href="#EPS1"><m:mi mathcolor="#EE0000" mathvariant="bold">EPS1</m:mi></m:maction><m:mo>,</m:mo><m:mi>&#949;</m:mi></m:mfenced></m:mrow></m:math>, <a class="arg" href="#EPS1">EPS1</a> being defined as in  <a class="sec" href="#parameters">Section 5</a> and <m:math><m:mi>&#949;</m:mi></m:math>&#160;being the  <span class="bitalic">machine precision</span>.</div><div class="paramtext"><b>Note:</b>&#160; interpretation of results obtained with the <m:math><m:mi>Q</m:mi><m:mi>Z</m:mi></m:math>&#160;algorithm often requires a clear understanding of the effects of small changes in the original data.  These effects are reviewed in <a class="ref" href="#ref109">Wilkinson (1979)</a>, in relation to the significance of small values of  <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>.  It should be noted that if <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>&#160;are <b>both</b> small for any <m:math><m:mi>j</m:mi></m:math>, it may be that no reliance can be placed on <b>any</b> of the computed eigenvalues  <m:math><m:msub><m:mi>&#955;</m:mi><m:mi>i</m:mi></m:msub><m:mo>=</m:mo><m:msub><m:mi>&#945;</m:mi><m:mi>i</m:mi></m:msub><m:mo>/</m:mo><m:msub><m:mi>&#946;</m:mi><m:mi>i</m:mi></m:msub></m:math>.  You are recommended to study <a class="ref" href="#ref109">Wilkinson (1979)</a> and, if in difficulty, to seek expert advice on determining the sensitivity of the eigenvalues to perturbations in the data.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">The time taken by F02GJF is approximately proportional to <m:math><m:msup><m:mi>n</m:mi><m:mn>3</m:mn></m:msup></m:math>&#160;and also depends on the value chosen for parameter <a class="arg" href="#EPS1">EPS1</a>.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example finds all the eigenvalues and eigenvectors of <m:math><m:mi>A</m:mi><m:mi>x</m:mi><m:mo>=</m:mo><m:mi>&#955;</m:mi><m:mi>B</m:mi><m:mi>x</m:mi></m:math>&#160;where

<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:mrow><m:mo>-</m:mo><m:mn>21.10</m:mn></m:mrow><m:mo>-</m:mo><m:mn>22.50</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>53.5</m:mn><m:mo>-</m:mo><m:mn>50.5</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>34.5</m:mn></m:mrow><m:mo>+</m:mo><m:mn>127.5</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>7.5</m:mn><m:mo>+</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>0.5</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>0.46</m:mn></m:mrow><m:mo>-</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>7.78</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>3.5</m:mn></m:mrow><m:mo>-</m:mo><m:mn>37.5</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>15.5</m:mn></m:mrow><m:mo>+</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>58.5</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>10.5</m:mn></m:mrow><m:mo>-</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>1.5</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>4.30</m:mn><m:mo>-</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>5.50</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>39.7</m:mn><m:mo>-</m:mo><m:mn>17.1</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>68.5</m:mn></m:mrow><m:mo>+</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>12.5</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>7.5</m:mn></m:mrow><m:mo>-</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>3.5</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>5.50</m:mn><m:mo>+</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>4.40</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>14.4</m:mn><m:mo>+</m:mo><m:mn>43.3</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>32.5</m:mn></m:mrow><m:mo>-</m:mo><m:mphantom><m:mn>0</m:mn></m:mphantom><m:mn>46.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>19.0</m:mn></m:mrow><m:mo>-</m:mo><m:mn>32.5</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr>
</m:mtable></m:mfenced>
</m:math></td><td class="formula2"/></tr></table></div>

and

<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:mo>-</m:mo><m:mn>5.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>1.6</m:mn><m:mo>+</m:mo><m:mn>1.2</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>3.0</m:mn></m:mrow><m:mphantom><m:mi>i</m:mi><m:mo>+</m:mo><m:mn>0.0</m:mn></m:mphantom></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>1.0</m:mn></m:mrow><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>0.8</m:mn><m:mo>-</m:mo><m:mn>0.6</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>3.0</m:mn><m:mo>-</m:mo><m:mn>5.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>4.0</m:mn></m:mrow><m:mo>+</m:mo><m:mn>3.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>2.4</m:mn></m:mrow><m:mo>-</m:mo><m:mn>3.2</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>1.0</m:mn><m:mphantom><m:mi>i</m:mi><m:mo>+</m:mo><m:mn>0.0</m:mn></m:mphantom></m:mtd>
   <m:mtd><m:mn>2.4</m:mn><m:mo>+</m:mo><m:mn>1.8</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>4.0</m:mn></m:mrow><m:mo>-</m:mo><m:mn>5.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>3.0</m:mn></m:mrow><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mn>1.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>1.8</m:mn></m:mrow><m:mo>+</m:mo><m:mn>2.4</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.0</m:mn><m:mo>-</m:mo><m:mn>4.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>4.0</m:mn><m:mo>-</m:mo><m:mn>5.0</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr>
</m:mtable></m:mfenced>
<m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></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/f02gjfe.f">Program Text (f02gjfe.f)</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/f02gjfe.d">Program&#160;Data (f02gjfe.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/f02gjfe.r">Program Results (f02gjfe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/F02/f02gjf.pdf">F02GJF (PDF version)</a></div><div><a class="chap" href="f02conts.xml">F02 Chapter Contents</a></div><div><a class="chapint" href="f02intro.xml">F02 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. 2009</a></div></body></html>
