
<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xml:space="preserve"><head><title>
  NAG C Library, Mark 7 : 
  f07mrc</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 href="../../pdf/F07/f07mrc.pdf">f07mrc (pdf version)</a></div><div><a href="f07_conts.xml">Chapter Contents</a></div><div><a href="f07_intro.xml">Chapter Introduction</a></div>
<div><a href="../mark7.xml">NAG C Library Contents</a></div><hr/><h1 class="libdoc">NAG C Library Function Document<br/><br/>nag_zhetrf (f07mrc)</h1>


<div class="htmltoc">
<h2><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">&#160;1&#160;<b>Purpose</b></a>
<div class="htmltocitem" id="tocpurpose"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#specification">&#160;2&#160;<b>Specification</b></a>
<div class="htmltocitem" id="tocspecification"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">&#160;3&#160;<b>Description</b></a>
<div class="htmltocitem" id="tocdescription"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">&#160;4&#160;<b>References</b></a>
<div class="htmltocitem" id="tocreferences"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">&#160;5&#160;<b>Parameters</b></a>
<div class="htmltocitem" id="tocparameters"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">&#160;6&#160;<b>Error Indicators and Warnings</b></a>
<div class="htmltocitem" id="tocerrors"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">&#160;7&#160;<b>Accuracy</b></a>
<div class="htmltocitem" id="tocaccuracy"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments">&#160;8&#160;<b>Further Comments</b></a>
<div class="htmltocitem" id="tocfcomments"/>
</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">&#160;9&#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">&#160;9.1&#160;<b>Program Text</b></a>
<div class="htmltocitem" id="tocexamtext"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">&#160;9.2&#160;<b>Program Data</b></a>
<div class="htmltocitem" id="tocexamdata"/>
</div>

<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">&#160;9.3&#160;<b>Program Results</b></a>
<div class="htmltocitem" id="tocexamresults"/>
</div>
</div>
</div>
</div>
</div>




<h2><a name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2>

<div class="paramtext">nag_zhetrf (f07mrc) computes the Bunch&#8211;Kaufman factorization of a complex Hermitian indefinite matrix.</div>





<h2><a name="specification" id="specification"/>2&#160;&#160;Specification</h2>


<table class="cspec">
<tr><td class="tdcspec" colspan="2">#include &lt;nag.h&gt;<br/>
#include &lt;nagf07.h&gt;<br/><br/></td></tr>
<tr><td class="tdcspec">
void&#160;nag_zhetrf</td><td class="tdcspec">(Nag_OrderType&#160;<a class="argref" href="#order">order</a>, Nag_UploType&#160;<a class="argref" href="#uplo">uplo</a>, Integer&#160;<a class="argref" href="#n">n</a>, Complex&#160;<a class="argref" href="#a">a</a>[], Integer&#160;<a class="argref" href="#pda">pda</a>, Integer&#160;<a class="argref" href="#ipiv">ipiv</a>[], NagError&#160;*<a class="argref" href="#fail">fail</a>)

   
</td></tr>
</table>





<h2><a name="description" id="description"/>3&#160;&#160;Description</h2>

<div class="paramtext">nag_zhetrf (f07mrc) factorizes a complex Hermitian matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>, using the Bunch&#8211;Kaufman diagonal pivoting method.  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is factorized as either <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mo>=</mo><mi>P</mi><mi>U</mi><mi>D</mi><msup><mi>U</mi><mi mathvariant="italic">H</mi></msup><msup><mi>P</mi><mi mathvariant="italic">T</mi></msup></math>&#160;if <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Upper</b>, or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mo>=</mo><mi>P</mi><mi>L</mi><mi>D</mi><msup><mi>L</mi><mi mathvariant="italic">H</mi></msup><msup><mi>P</mi><mi mathvariant="italic">T</mi></msup></math>&#160;if <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Lower</b>, where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi></math>&#160;is a permutation matrix, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;(or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>) is a unit upper (or lower) triangular matrix and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;is an Hermitian block diagonal matrix with 1 by 1 and 2 by 2 diagonal blocks; <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;(or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>) has 2 by 2 unit diagonal blocks corresponding to the 2 by 2 blocks of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>.  Row and column interchanges are performed to ensure numerical stability while keeping the matrix Hermitian.</div>
<div class="paramtext">This method is suitable for Hermitian matrices which are not known to be positive-definite.  If <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is in fact positive-definite, no interchanges are performed and no 2 by 2 blocks occur in <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>.</div>





<h2><a name="references" id="references"/>4&#160;&#160;References</h2>

<div class="paramtext">
<p><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 </p>
</div>





<h2><a name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>


<dl><dt class="paramhead"><a name="order" id="order"/>1:
 &#160;&#160;&#8194;
 <b>order</b> &#8211; Nag_OrderType<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the 
  <a class="argref" href="#order">order</a>
  parameter specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by 
  <a class="argref" href="#order">order</a>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_RowMajor</b>. 
  See Section <a class="secref" href="../genint/essint.xml#usingarrayrefs">2.2.1.4</a> of the Essential Introduction for a more detailed explanation of the use of this parameter.</div>
<div class="paramtext"><i>Constraint</i>:
  <a class="argref" href="#order">order</a>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_RowMajor</b> 
  or <b>Nag_ColMajor</b>.</div>
</dd><dt class="paramhead"><a name="uplo" id="uplo"/>2:
 &#160;&#160;&#8194;
 <b>uplo</b> &#8211; Nag_UploType&#160;<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: indicates whether the upper or lower triangular part of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is stored and how <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;has been factorized, as follows:
<ul class="listind"><li class="listind">if <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Upper</b>, the upper triangular part of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is stored and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is factorized as <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mi>U</mi><mi>D</mi><msup><mi>U</mi><mi mathvariant="italic">H</mi></msup><msup><mi>P</mi><mi mathvariant="italic">T</mi></msup></math>, where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;is upper triangular;</li><li class="listind">if <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Lower</b>, the lower triangular part of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is stored and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is factorized as <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mi>L</mi><mi>D</mi><msup><mi>L</mi><mi mathvariant="italic">H</mi></msup><msup><mi>P</mi><mi mathvariant="italic">T</mi></msup></math>, where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;is lower triangular.</li></ul>
</div>

<div class="paramtext"><i>Constraint</i>:
  <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Upper</b> or <b>Nag_Lower</b>.</div>

</dd><dt class="paramhead"><a name="n" id="n"/>3:
 &#160;&#160;&#8194;
 <b>n</b> &#8211; Integer&#160;<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>, the order of the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>.</div>

<div class="paramtext"><i>Constraint</i>:
  <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction><mo>&#8805;</mo><mn>0</mn></math>.</div>

</dd><dt class="paramhead"><a name="a" id="a"/>4:
 &#160;&#160;&#8194;
 <b>a</b>[<math xmlns="http://www.w3.org/1998/Math/MathML"><mi mathvariant="italic">dim</mi></math>] &#8211; Complex&#160;<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> 
 the dimension, <span class="italic">dim</span>, of the array 
 <a class="argref" href="#a">a</a> must be at least 
<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>max</mi><mo>&#8289;</mo><mfenced separators=","><mn>1</mn><mrow><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>&#215;</mo><mrow><mi>max</mi><mo>&#8289;</mo><mfenced separators=""><mn>1</mn><mo>,</mo><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction></mfenced></mrow></mrow></mfenced></mrow></math>.</div>
<div class="paramtext">If 
   <a class="argref" href="#order">order</a>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_ColMajor</b>, 
   the <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced separators=","><mi>i</mi><mi>j</mi></mfenced></math>th element of the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is stored in <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><maction actiontype="link" dsi:href="#a" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">a</mi></maction><mfenced open="[" close="]"><mrow><mfenced separators=""><mi>j</mi><mo>-</mo><mn>1</mn></mfenced><mo>&#215;</mo><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>+</mo><mi>i</mi><mo>-</mo><mn>1</mn></mrow></mfenced></mrow></math>&#160;and if 
    <a class="argref" href="#order">order</a>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_RowMajor</b>, 
    the <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced separators=","><mi>i</mi><mi>j</mi></mfenced></math>th element of the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is stored in <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><maction actiontype="link" dsi:href="#a" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">a</mi></maction><mfenced open="[" close="]"><mrow><mfenced separators=""><mi>i</mi><mo>-</mo><mn>1</mn></mfenced><mo>&#215;</mo><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>+</mo><mi>j</mi><mo>-</mo><mn>1</mn></mrow></mfenced></mrow></math>.</div>

<div class="paramtext"><i>On entry</i>: the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;Hermitian matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>. If <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Upper</b>, the upper triangle of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;must be stored and the elements of the array below the diagonal are not referenced; if <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Lower</b>, the lower triangle of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;must be stored and the elements of the array above the diagonal are not referenced.</div>
<div class="paramtext"><i>On exit</i>: the upper or lower triangle of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is overwritten by details of the block diagonal matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;and the multipliers used to obtain the factor <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;as specified by <a class="argref" href="#uplo">uplo</a>.</div>

</dd><dt class="paramhead"><a name="pda" id="pda"/>5:
 &#160;&#160;&#8194;
 <b>pda</b> &#8211; Integer&#160;<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the stride separating row or column elements (depending on the value of 

 <a class="argref" href="#order">order</a>
) of the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;in the array 

 <a class="argref" href="#a">a</a>
 .</div>
<div class="paramtext"><i>Constraint</i>:
  <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>&#8805;</mo><mrow><mi>max</mi><mo>&#8289;</mo><mfenced separators=""><mn>1</mn><mo>,</mo><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction></mfenced></mrow></math>.</div></dd><dt class="paramhead"><a name="ipiv" id="ipiv"/>6:
 &#160;&#160;&#8194;
 <b>ipiv</b>[<math xmlns="http://www.w3.org/1998/Math/MathML"><mi mathvariant="italic">dim</mi></math>] &#8211; Integer&#160;<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><b>Note:</b>  
  the dimension, <span class="italic">dim</span>, of the array <a class="argref" href="#ipiv">ipiv</a> must be at least <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>max</mi><mo>&#8289;</mo><mfenced separators=""><mn>1</mn><mo>,</mo><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction></mfenced></mrow></math>.</div>

<div class="paramtext"><i>On exit</i>: details of the interchanges and the block structure of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>. More precisely, if <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><maction actiontype="link" dsi:href="#ipiv" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">ipiv</mi></maction><mfenced open="[" close="]"><mrow><mi>i</mi><mo>-</mo><mn>1</mn></mrow></mfenced></mrow></mrow><mo>=</mo><mi>k</mi><mo>&gt;</mo><mn>0</mn></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>d</mi><mrow><mi>i</mi><mi>i</mi></mrow></msub></math>&#160;is a 1 by 1 pivot block and the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>i</mi></math>th row and column of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;were interchanged with the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>k</mi></math>th row and column.
<div class="paramtext">If <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Upper</b> and <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><maction actiontype="link" dsi:href="#ipiv" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">ipiv</mi></maction><mfenced open="[" close="]"><mrow><mi>i</mi><mo>-</mo><mn>2</mn></mrow></mfenced></mrow></mrow><mo>=</mo><mrow><mrow><maction actiontype="link" dsi:href="#ipiv" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">ipiv</mi></maction><mfenced open="[" close="]"><mrow><mi>i</mi><mo>-</mo><mn>1</mn></mrow></mfenced></mrow></mrow><mo>=</mo><mo>-</mo><mi>l</mi><mo>&lt;</mo><mn>0</mn></math>,
<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mfenced separators="">
  <mtable>
   <mtr>
    <mtd><msub><mi>d</mi><mrow><mi>i</mi><mo>-</mo><mn>1</mn><mo>,</mo><mi>i</mi><mo>-</mo><mn>1</mn></mrow></msub></mtd>
    <mtd><msub><mover><mrow><mi>d</mi></mrow><mo>-</mo></mover><mrow><mi>i</mi><mo>,</mo><mi>i</mi><mo>-</mo><mn>1</mn></mrow></msub></mtd>
   </mtr>
   <mtr>
    <mtd><msub><mover><mrow><mi>d</mi></mrow><mo>-</mo></mover><mrow><mi>i</mi><mo>,</mo><mi>i</mi><mo>-</mo><mn>1</mn></mrow></msub></mtd>
    <mtd><msub><mi>d</mi><mrow><mi>i</mi><mi>i</mi></mrow></msub></mtd>
   </mtr>
  </mtable>
 </mfenced>
</math>&#160;is a 2 by 2 pivot block and the <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced separators=""><mi>i</mi><mo>-</mo><mn>1</mn></mfenced></math>th row and column of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;were interchanged with the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>l</mi></math>th row and column.</div><div class="paramtext">If <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Lower</b> and <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><maction actiontype="link" dsi:href="#ipiv" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">ipiv</mi></maction><mfenced open="[" close="]"><mrow><mi>i</mi><mo>-</mo><mn>1</mn></mrow></mfenced></mrow></mrow><mo>=</mo><mrow><mrow><maction actiontype="link" dsi:href="#ipiv" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">ipiv</mi></maction><mfenced open="[" close="]"><mi>i</mi></mfenced></mrow></mrow><mo>=</mo><mo>-</mo><mi>m</mi><mo>&lt;</mo><mn>0</mn></math>,
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mfenced separators="">
<mtable>
<mtr>
<mtd><msub><mi>d</mi><mrow><mi>i</mi><mi>i</mi></mrow></msub></mtd><mtd><msub><mi>d</mi><mrow><mi>i</mi><mo>+</mo><mn>1</mn><mo>,</mo><mi>i</mi></mrow></msub></mtd>
</mtr>
<mtr>
<mtd><msub><mi>d</mi><mrow><mi>i</mi><mo>+</mo><mn>1</mn><mo>,</mo><mi>i</mi></mrow></msub></mtd><mtd><msub><mi>d</mi><mrow><mi>i</mi><mo>+</mo><mn>1</mn><mo>,</mo><mi>i</mi><mo>+</mo><mn>1</mn></mrow></msub></mtd>
</mtr>
</mtable>
</mfenced>
</math>&#160;is a 2 by 2 pivot block and the <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced separators=""><mi>i</mi><mo>+</mo><mn>1</mn></mfenced></math>th row and column of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;were interchanged with the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>th row and column.</div></div>

</dd><dt class="paramhead"><a name="fail" id="fail"/>7:
 &#160;&#160;&#8194;
 <b>fail</b> &#8211; NagError&#160;*<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext">The NAG error parameter (see the <a class="secref" href="../genint/essint.xml">Essential Introduction</a>).</div>
</dd></dl>





<h2><a name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>



<dl>



<dt class="errorhead"><a name="NE_INT" id="NE_INT"/><b>NE_INT</b></dt>
<dd style="margin-top: .2em;">
<div class="paramtext">On entry, <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction><mo>=</mo><mfenced open="&#9001;" close="&#9002;" separators=""><mtext mathvariant="italic">value</mtext></mfenced></math>.<br/>
Constraint: <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction><mo>&#8805;</mo><mn>0</mn></math>.</div>
</dd>
<dd style="margin-top: .2em;">
<div class="paramtext">On entry, <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>=</mo><mfenced open="&#9001;" close="&#9002;" separators=""><mtext mathvariant="italic">value</mtext></mfenced></math>.<br/>
Constraint: <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>&gt;</mo><mn>0</mn></math>.</div>
</dd>




<dt class="errorhead"><a name="NE_INT_2" id="NE_INT_2"/><b>NE_INT_2</b></dt>
<dd style="margin-top: .2em;">
<div class="paramtext">On entry, <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>=</mo><mfenced open="&#9001;" close="&#9002;" separators=""><mtext mathvariant="italic">value</mtext></mfenced></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction><mo>=</mo><mfenced open="&#9001;" close="&#9002;" separators=""><mtext mathvariant="italic">value</mtext></mfenced></math>.<br/>
Constraint: <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#pda" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">pda</mi></maction><mo>&#8805;</mo><mrow><mi>max</mi><mo>&#8289;</mo><mfenced separators=""><mn>1</mn><mo>,</mo><maction actiontype="link" dsi:href="#n" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">n</mi></maction></mfenced></mrow></math>.</div>
</dd>



<dt class="errorhead"><a name="NE_SINGULAR" id="NE_SINGULAR"/><b>NE_SINGULAR</b></dt>
<dd style="margin-top: .2em;">
<div class="paramtext">
The block diagonal matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;is exactly singular.

</div>
</dd>


<dt class="errorhead"><a name="NE_ALLOC_FAIL" id="NE_ALLOC_FAIL"/><b>NE_ALLOC_FAIL</b></dt>
<dd style="margin-top: .2em;">
<div class="paramtext">Memory allocation failed.</div>
</dd>


<dt class="errorhead"><a name="NE_BAD_PARAM" id="NE_BAD_PARAM"/><b>NE_BAD_PARAM</b></dt>
<dd style="margin-top: .2em;">
<div class="paramtext">On entry, parameter <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced open="&#9001;" close="&#9002;" separators=""><mtext mathvariant="italic">value</mtext></mfenced></math>&#160;had an illegal value.</div>
</dd>



<dt class="errorhead"><a name="NE_INTERNAL_ERROR" id="NE_INTERNAL_ERROR"/><b>NE_INTERNAL_ERROR</b></dt>
<dd style="margin-top: .2em;">
<div class="paramtext">An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.</div>
</dd>

</dl>






<h2><a name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>

<div class="paramtext">If <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Upper</b>, the computed factors <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;are the exact factors of a perturbed matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mo>+</mo><mi>E</mi></math>, where
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mfenced open="|" close="|" separators=""><mi>E</mi></mfenced><mo>&#8804;</mo><mi>c</mi><mfenced separators=""><mi>n</mi></mfenced><mi>&#949;</mi><mi>P</mi><mfenced open="|" close="|" separators=""><mi>U</mi></mfenced><mfenced open="|" close="|" separators=""><mi>D</mi></mfenced><mfenced open="|" close="|" separators=""><msup><mi>U</mi><mi mathvariant="italic">H</mi></msup></mfenced><msup><mi>P</mi><mi mathvariant="italic">T</mi></msup><mtext>,</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>c</mi><mfenced separators=""><mi>n</mi></mfenced></math>&#160;is a modest linear function of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>, and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#949;</mi></math>&#160;is the <span class="bitalic">machine precision</span>.</div>
<div class="paramtext">If <math xmlns="http://www.w3.org/1998/Math/MathML"><maction actiontype="link" dsi:href="#uplo" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">uplo</mi></maction></math>&#160;<math xmlns="http://www.w3.org/1998/Math/MathML"><mo>=</mo></math>&#160;<b>Nag_Lower</b>, a similar statement holds for the computed factors <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>.</div>





<h2><a name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>

<div class="paramtext">The elements of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;overwrite the corresponding elements of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>; if <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;has 2 by 2 blocks, only the upper or lower triangle is stored, as specified by <a class="argref" href="#uplo">uplo</a>.</div>
<div class="paramtext">The unit diagonal elements of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;and the 2 by 2 unit diagonal blocks are not stored.  The remaining elements of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;are stored in the corresponding columns of the array <a class="argref" href="#a">a</a>, but additional row interchanges must be applied to recover <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;explicitly (this is seldom necessary).  If <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><maction actiontype="link" dsi:href="#ipiv" dsi:type="simple"><mi mathcolor="#EE0000" mathvariant="bold">ipiv</mi></maction><mfenced open="[" close="]"><mrow><mi>i</mi><mo>-</mo><mn>1</mn></mrow></mfenced></mrow></mrow><mo>=</mo><mi>i</mi></math>, for <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>i</mi><mo>=</mo><mn>1</mn><mo>,</mo><mn>2</mn><mo>,</mo><mo>&#8230;</mo><mo>,</mo><mi>n</mi></math>&#160;(as is the case when <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is positive-definite), then <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;is stored explicitly (except for its unit diagonal elements which are equal to 1).</div>
<div class="paramtext">The total number of real floating-point operations is approximately <math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>4</mn><mn>3</mn></mfrac><msup><mi>n</mi><mn>3</mn></msup></math>.</div>
<div class="paramtext">A call to this function may be followed by calls to the functions:
</div><ul class="listind"><li class="listind"><a class="rtnref" href="../F07/f07msc.xml">nag_zhetrs (f07msc)</a> to solve <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>X</mi><mo>=</mo><mi>B</mi></math>;</li><li class="listind"><a class="rtnref" href="../F07/f07muc.xml">nag_zhecon (f07muc)</a> to estimate the condition number of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>;</li><li class="listind"><a class="rtnref" href="../F07/f07mwc.xml">nag_zhetri (f07mwc)</a> to compute the inverse of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>.</li></ul><div class="paramtext">
</div>
<div class="paramtext">The real analogue of this function is <a class="rtnref" href="../F07/f07mdc.xml">nag_dsytrf (f07mdc)</a>.</div>





<h2><a name="example" id="example"/>9&#160;&#160;Example</h2>

<div class="paramtext">To compute the Bunch&#8211;Kaufman factorization of the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>, where
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>A</mi><mo>=</mo><mfenced separators="">
 <mtable>
  <mtr columnalign="right">
   <mtd><mrow><mo>-</mo><mn>1.36</mn></mrow><mo>+</mo><mn>0.00</mn><mi>i</mi></mtd>
   <mtd><mphantom><mo>-</mo></mphantom><mn>1.58</mn><mo>+</mo><mn>0.90</mn><mi>i</mi></mtd>
   <mtd><mphantom><mo>-</mo></mphantom><mn>2.21</mn><mo>-</mo><mn>0.21</mn><mi>i</mi></mtd>
   <mtd><mphantom><mo>-</mo></mphantom><mn>3.91</mn><mo>+</mo><mn>1.50</mn><mi>i</mi></mtd>
  </mtr><mtr columnalign="right">
   <mtd><mphantom><mo>-</mo></mphantom><mn>1.58</mn><mo>-</mo><mn>0.90</mn><mi>i</mi></mtd>
   <mtd><mrow><mo>-</mo><mn>8.87</mn></mrow><mo>+</mo><mn>0.00</mn><mi>i</mi></mtd>
   <mtd><mrow><mo>-</mo><mn>1.84</mn></mrow><mo>-</mo><mn>0.03</mn><mi>i</mi></mtd>
   <mtd><mrow><mo>-</mo><mn>1.78</mn></mrow><mo>+</mo><mn>1.18</mn><mi>i</mi></mtd>
  </mtr><mtr columnalign="right">
   <mtd><mphantom><mo>-</mo></mphantom><mn>2.21</mn><mo>+</mo><mn>0.21</mn><mi>i</mi></mtd>
   <mtd><mrow><mo>-</mo><mn>1.84</mn></mrow><mo>+</mo><mn>0.03</mn><mi>i</mi></mtd>
   <mtd><mrow><mo>-</mo><mn>4.63</mn></mrow><mo>+</mo><mn>0.00</mn><mi>i</mi></mtd>
   <mtd><mphantom><mo>-</mo></mphantom><mn>0.11</mn><mo>+</mo><mn>0.11</mn><mi>i</mi></mtd>
  </mtr><mtr columnalign="right">
   <mtd><mphantom><mo>-</mo></mphantom><mn>3.91</mn><mo>-</mo><mn>1.50</mn><mi>i</mi></mtd>
   <mtd><mrow><mo>-</mo><mn>1.78</mn></mrow><mo>-</mo><mn>1.18</mn><mi>i</mi></mtd>
   <mtd><mphantom><mo>-</mo></mphantom><mn>0.11</mn><mo>-</mo><mn>0.11</mn><mi>i</mi></mtd>
   <mtd><mrow><mo>-</mo><mn>1.84</mn></mrow><mo>+</mo><mn>0.00</mn><mi>i</mi></mtd>
  </mtr>
 </mtable>
</mfenced>
<mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
</div>



<h3><a name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
 
<div><a href="../../examples/source/f07mrce.c">Program Text (f07mrce.c)</a></div>





<h3><a name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>

<div><a href="../../examples/data/f07mrce.d">Program Data (f07mrce.d)</a></div>




<h3><a name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>

<div><a href="../../examples/baseresults/f07mrce.r">Program Results (f07mrce.r)</a></div>


<hr/><div><a href="../../pdf/F07/f07mrc.pdf">f07mrc (pdf version)</a></div><div><a href="f07_conts.xml">Chapter Contents</a></div><div><a href="f07_intro.xml">Chapter Introduction</a></div>
<div><a href="../mark7.xml">NAG C Library Contents</a></div>
<div><hr/>
  &#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2004
  </div></body></html>