<?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>F01RJF : 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/F01/f01rjf.pdf">F01RJF (PDF version)</a></div><div><a class="chap" href="f01conts.xml">F01 Chapter Contents</a></div><div><a class="chapint" href="f01intro.xml">F01 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/>F01RJF</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">F01RJF finds the <m:math><m:mi>R</m:mi><m:mi>Q</m:mi></m:math>&#160;factorization of the complex <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;(<m:math><m:mi>m</m:mi><m:mo>&#8804;</m:mo><m:mi>n</m:mi></m:math>),  matrix <m:math><m:mi>A</m:mi></m:math>, so that <m:math><m:mi>A</m:mi></m:math>&#160;is reduced to upper triangular form by means of unitary transformations from the right.</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;F01RJF&#160;(</td><td class="tdfspec2"><a class="arg" href="#M">M</a>, <a class="arg" href="#N">N</a>, <a class="arg" href="#A">A</a>, <a class="arg" href="#LDA">LDA</a>, <a class="arg" href="#THETA">THETA</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">M, N, LDA, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>complex*16</i></b></td><td class="tdfspec2">A(LDA,*), THETA(M)</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">The <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;matrix <m:math><m:mi>A</m:mi></m:math>&#160;is factorized as

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mtable columnalign="left">
 <m:mtr>
  <m:mtd><m:mi>A</m:mi><m:mo>=</m:mo><m:mfenced><m:mtable>
   <m:mtr>
     <m:mtd><m:mi>R</m:mi></m:mtd>
     <m:mtd><m:mn>0</m:mn></m:mtd>
   </m:mtr>
 </m:mtable></m:mfenced>
<m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">H</m:mi></m:msup></m:mtd>
  <m:mtd><m:mtext>when &#8203;</m:mtext><m:mi>m</m:mi><m:mo>&lt;</m:mo><m:mi>n</m:mi><m:mtext>,</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd/>
  <m:mtd/></m:mtr><m:mtr>
  <m:mtd><m:mi>A</m:mi><m:mo>=</m:mo><m:mi>R</m:mi><m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">H</m:mi></m:msup></m:mtd>
  <m:mtd><m:mtext>when &#8203;</m:mtext><m:mi>m</m:mi><m:mo>=</m:mo><m:mi>n</m:mi><m:mtext>,</m:mtext></m:mtd>
 </m:mtr>
</m:mtable>
</m:math></td><td class="formula2"/></tr></table></div>

where <m:math><m:mi>P</m:mi></m:math>&#160;is an <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;unitary matrix and <m:math><m:mi>R</m:mi></m:math>&#160;is an <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>m</m:mi></m:math>&#160;upper triangular matrix.</div><div class="paramtext"><m:math><m:mi>P</m:mi></m:math>&#160;is given as a sequence of Householder transformation matrices

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>P</m:mi><m:mo>=</m:mo><m:msub><m:mi>P</m:mi><m:mi>m</m:mi></m:msub><m:mo>&#8943;</m:mo><m:msub><m:mi>P</m:mi><m:mn>2</m:mn></m:msub><m:msub><m:mi>P</m:mi><m:mn>1</m:mn></m:msub><m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

the <m:math><m:mfenced separators=""><m:mi>m</m:mi><m:mo>-</m:mo><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mfenced></m:math>th transformation matrix, <m:math><m:msub><m:mi>P</m:mi><m:mi>k</m:mi></m:msub></m:math>,  being used to introduce zeros into the <m:math><m:mi>k</m:mi></m:math>th row of <m:math><m:mi>A</m:mi></m:math>.  <m:math><m:msub><m:mi>P</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;has the form

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>P</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mi>I</m:mi><m:mo>-</m:mo><m:msub><m:mi>&#947;</m:mi><m:mi>k</m:mi></m:msub><m:msub><m:mi>u</m:mi><m:mi>k</m:mi></m:msub><m:msubsup><m:mi>u</m:mi><m:mi>k</m:mi><m:mi>H</m:mi></m:msubsup><m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

where

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>u</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mfenced><m:mtable columnalign="left">
  <m:mtr>
   <m:mtd><m:msub><m:mi>w</m:mi><m:mi>k</m:mi></m:msub></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd><m:msub><m:mi>&#950;</m:mi><m:mi>k</m:mi></m:msub></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd><m:mn>0</m:mn></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd><m:msub><m:mi>z</m:mi><m:mi>k</m:mi></m:msub></m:mtd>
  </m:mtr>
 </m:mtable></m:mfenced>
<m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div><m:math><m:msub><m:mi>&#947;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;is a scalar for which  <m:math><m:mrow><m:mi>Re</m:mi><m:mfenced separators=""><m:msub><m:mi>&#947;</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>1.0</m:mn></m:math>, <m:math><m:msub><m:mi>&#950;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;is a real scalar, <m:math><m:msub><m:mi>w</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;is a <m:math><m:mfenced separators=""><m:mi>k</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mfenced></m:math>&#160;element vector and <m:math><m:msub><m:mi>z</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;is an <m:math><m:mfenced separators=""><m:mi>n</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:mfenced></m:math>&#160;element vector.  <m:math><m:msub><m:mi>&#947;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>u</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;are chosen to annihilate the elements in the <m:math><m:mi>k</m:mi></m:math>th row of <m:math><m:mi>A</m:mi></m:math>.</div><div class="paramtext">The scalar <m:math><m:msub><m:mi>&#947;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;and the vector <m:math><m:msub><m:mi>u</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;are returned in the <m:math><m:mi>k</m:mi></m:math>th element of <a class="arg" href="#THETA">THETA</a> and in the  <m:math><m:mi>k</m:mi></m:math>th row of <a class="arg" href="#A">A</a>, such that <m:math><m:msub><m:mi>&#952;</m:mi><m:mi>k</m:mi></m:msub></m:math>, given by

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>&#952;</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mfenced separators=""><m:msub><m:mi>&#950;</m:mi><m:mi>k</m:mi></m:msub><m:mo>,</m:mo><m:mrow><m:mi>Im</m:mi><m:mfenced separators=""><m:msub><m:mi>&#947;</m:mi><m:mi>k</m:mi></m:msub></m:mfenced></m:mrow></m:mfenced><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

is in <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#THETA"><m:mi mathcolor="#EE0000" mathvariant="bold">THETA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>k</m:mi></m:mfenced></m:mrow></m:math>, the elements of <m:math><m:msub><m:mi>w</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;are in <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:mi>k</m:mi><m:mn>1</m:mn></m:mfenced></m:mrow><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><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:mi>k</m:mi><m:mrow><m:mi>k</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:mfenced></m:mrow></m:math>&#160;and the elements of  <m:math><m:msub><m:mi>z</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;are in <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:mi>k</m:mi><m:mrow><m:mi>m</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mrow></m:mfenced></m:mrow><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><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:mi>k</m:mi><m:mi>n</m:mi></m:mfenced></m:mrow></m:math>.  The elements of <m:math><m:mi>R</m:mi></m:math>&#160;are returned in the upper triangular part of <a class="arg" href="#A">A</a>.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><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="ref003" id="ref003"/>Wilkinson J H (1965)  <i>The Algebraic Eigenvalue Problem</i> Oxford University Press, Oxford </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="M" id="M"/>1: &#160;&#160;&#8194; M &#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="#THETA">THETA</a> as declared in the (sub)program from which F01RJF is called.<m:math><m:mi>m</m:mi></m:math>, the number of rows of the matrix <m:math><m:mi>A</m:mi></m:math>.
<div class="paramtext">When <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;then an immediate return is effected.</div>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>0</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="N" id="N"/>2: &#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 number of columns of the matrix <m:math><m:mi>A</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:maction actiontype="link" dsi:type="simple" dsi:href="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction></m:math>.
</div></dd><dt class="paramhead"><a name="A" id="A"/>3: &#160;&#160;&#8194; A(<a class="arg" href="#LDA">LDA</a>,<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">complex*16</span> 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 leading <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;part of the array <a class="arg" href="#A">A</a> must contain the matrix to be factorized.</div>
<div class="paramtext"><i>On exit</i>: the <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>m</m:mi></m:math>&#160;upper triangular part of <a class="arg" href="#A">A</a> will contain the upper triangular matrix <m:math><m:mi>R</m:mi></m:math>, and the <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>m</m:mi></m:math>&#160;strictly lower triangular part of <a class="arg" href="#A">A</a> and the <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mfenced separators=""><m:mi>n</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:mfenced></m:math>&#160;rectangular part of <a class="arg" href="#A">A</a> to the right of the upper triangular part will contain details of the factorization as described in <a class="sec" href="#description">Section 3</a>.</div></dd><dt class="paramhead"><a name="LDA" id="LDA"/>4: &#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 F01RJF 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="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction></m:mfenced></m:mrow></m:math>.
</div></dd><dt class="paramhead"><a name="THETA" id="THETA"/>5: &#160;&#160;&#8194; THETA(<a class="arg" href="#M">M</a>) &#8211; <span class="bitalic">complex*16</span> 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="#THETA"><m:mi mathcolor="#EE0000" mathvariant="bold">THETA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>k</m:mi></m:mfenced></m:mrow></m:math>&#160;contains the scalar <m:math><m:msub><m:mi>&#952;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;for the <m:math><m:mfenced separators=""><m:mi>m</m:mi><m:mo>-</m:mo><m:mi>k</m:mi><m:mo>+</m:mo><m:mn>1</m:mn></m:mfenced></m:math>th transformation. If <m:math><m:msub><m:mi>P</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mi>I</m:mi></m:math>&#160;then <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#THETA"><m:mi mathcolor="#EE0000" mathvariant="bold">THETA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>k</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>0.0</m:mn></m:math>; if 
<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block"> <m:msub><m:mi>T</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mfenced><m:mtable columnalign="left"> <m:mtr> <m:mtd><m:mi>I</m:mi></m:mtd> <m:mtd><m:mn>0</m:mn></m:mtd> <m:mtd><m:mn>0</m:mn></m:mtd> </m:mtr><m:mtr> <m:mtd><m:mn>0</m:mn></m:mtd> <m:mtd><m:mi>&#945;</m:mi></m:mtd> <m:mtd><m:mn>0</m:mn></m:mtd> </m:mtr><m:mtr> <m:mtd><m:mn>0</m:mn></m:mtd> <m:mtd><m:mn>0</m:mn></m:mtd> <m:mtd><m:mi>I</m:mi></m:mtd> </m:mtr> </m:mtable></m:mfenced><m:mtext>, &#8195;</m:mtext><m:mrow><m:mi>Re</m:mi><m:mfenced separators=""><m:mi>&#945;</m:mi></m:mfenced></m:mrow><m:mo>&lt;</m:mo><m:mn>0.0</m:mn> </m:math></td><td class="formula2"/></tr></table></div>
 then <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#THETA"><m:mi mathcolor="#EE0000" mathvariant="bold">THETA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>k</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mi>&#945;</m:mi></m:math>, otherwise <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#THETA"><m:mi mathcolor="#EE0000" mathvariant="bold">THETA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>k</m:mi></m:mfenced></m:mrow></m:math>&#160;contains <m:math><m:msub><m:mi>&#952;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;as described in <a class="sec" href="#description">Section 3</a> and <m:math><m:msub><m:mi>&#952;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;is always in the range <m:math><m:mfenced separators=""><m:mn>1.0</m:mn><m:mo>,</m:mo><m:msqrt><m:mn>2.0</m:mn></m:msqrt></m:mfenced></m:math>.</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>6: &#160;&#160;&#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="IFeq-1" id="IFeq-1"/><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:mn>-1</m:mn></m:math></dt>
<dd>
<table class="ifail"><tr><td class="ifail1">On&#160;entry,</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><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>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><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>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction></m:math>.</td></tr></table>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">The computed factors <m:math><m:mi>R</m:mi></m:math>&#160;and <m:math><m:mi>P</m:mi></m:math>&#160;satisfy the relation

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mfenced separators=""><m:mi>R</m:mi><m:mn>0</m:mn></m:mfenced><m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">H</m:mi></m:msup><m:mo>=</m:mo><m:mi>A</m:mi><m:mo>+</m:mo><m:mi>E</m:mi><m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

where

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mfenced open="&#8214;" close="&#8214;" separators=""><m:mi>E</m:mi></m:mfenced><m:mo>&#8804;</m:mo><m:mi>c</m:mi><m:mi>&#949;</m:mi> <m:mfenced open="&#8214;" close="&#8214;" separators=""><m:mi>A</m:mi></m:mfenced><m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div><m:math><m:mi>&#949;</m:mi></m:math>&#160;is the <span class="bitalic">machine precision</span> (see <a class="rout" href="../X02/x02ajf.xml">X02AJF</a>),  <m:math><m:mi>c</m:mi></m:math>&#160;is a modest function of <m:math><m:mi>m</m:mi></m:math>&#160;and <m:math><m:mi>n</m:mi></m:math>,  and <m:math><m:mfenced open="&#8214;" close="&#8214;" separators=""><m:mo>.</m:mo></m:mfenced></m:math>&#160;denotes the spectral (two) norm.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">The approximate number of floating-point operations is given by <m:math><m:mn>8</m:mn><m:mo>&#8290;</m:mo><m:msup><m:mi>m</m:mi><m:mn>2</m:mn></m:msup><m:mfenced separators=""><m:mn>3</m:mn><m:mi>n</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:mfenced><m:mo>/</m:mo><m:mn>3</m:mn></m:math>.</div><div class="paramtext">The first <m:math><m:mi>k</m:mi></m:math>&#160;rows of the unitary matrix <m:math><m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">H</m:mi></m:msup></m:math>&#160;can be obtained by calling <a class="rout" href="../F01/f01rkf.xml">F01RKF</a>, which overwrites the  <m:math><m:mi>k</m:mi></m:math>&#160;rows of <m:math><m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">H</m:mi></m:msup></m:math>&#160;on the first <m:math><m:mi>k</m:mi></m:math>&#160;rows of the array <a class="arg" href="#A">A</a>.  <m:math><m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">H</m:mi></m:msup></m:math>&#160;is obtained by the call:
<pre class="verbatim">
IFAIL = 0
CALL F01RKF('Separate',M,N,K,A,LDA,THETA,WORK,IFAIL)
</pre></div><div class="paramtext"><m:math><m:mi mathvariant="normal">WORK</m:mi></m:math>&#160;must be a <m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mrow><m:mi>m</m:mi><m:mo>-</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mi>k</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:mrow><m:mo>,</m:mo><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>&#160;element array.  If <m:math><m:mi mathvariant="normal">K</m:mi></m:math>&#160;is larger than <m:math><m:mi mathvariant="normal">M</m:mi></m:math>, then <a class="arg" href="#A">A</a> must have been declared to have at least <m:math><m:mi mathvariant="normal">K</m:mi></m:math>&#160;rows.</div><div class="paramtext">Operations involving the matrix <m:math><m:mi>R</m:mi></m:math>&#160;can readily be performed by the Level 2 BLAS routines <a class="rout" href="../F06/f06sff.xml">F06SFF (ZTRMV)</a> and <a class="rout" href="../F06/f06sjf.xml">F06SJF (ZTRSV)</a>, (see  <a class="chap" href="../F06/f06conts.xml">Chapter F06</a>), but note that no test for near singularity of <m:math><m:mi>R</m:mi></m:math>&#160;is incorporated into <a class="rout" href="../F06/f06sff.xml">F06SFF (ZTRMV)</a>.  If <m:math><m:mi>R</m:mi></m:math>&#160;is singular, or nearly singular then <a class="rout" href="../F02/f02xuf.xml">F02XUF</a> can be used to determine the singular value decomposition of <m:math><m:mi>R</m:mi></m:math>.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example obtains the <m:math><m:mi>R</m:mi><m:mi>Q</m:mi></m:math>&#160;factorization of the <m:math><m:mn>3</m:mn></m:math>&#160;by <m:math><m:mn>5</m:mn></m:math>&#160;matrix

<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>0.5</m:mn></m:mrow><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.4</m:mn><m:mo>-</m:mo><m:mn>0.3</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.4</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>0.3</m:mn><m:mo>-</m:mo><m:mn>0.4</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.3</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>0.5</m:mn></m:mrow><m:mo>-</m:mo><m:mn>1.5</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.9</m:mn><m:mo>-</m:mo><m:mn>1.3</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>0.4</m:mn></m:mrow><m:mo>-</m:mo><m:mn>0.4</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.1</m:mn><m:mo>-</m:mo><m:mn>0.7</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.3</m:mn><m:mo>-</m:mo><m:mn>0.3</m:mn><m:mi>i</m:mi></m:mtd>
</m:mtr><m:mtr>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>1.0</m:mn></m:mrow><m:mo>-</m:mo><m:mn>1.0</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>0.2</m:mn><m:mo>-</m:mo><m:mn>1.4</m:mn><m:mi>i</m:mi></m:mtd>
   <m:mtd><m:mn>1.8</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>0.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:mrow><m:mo>-</m:mo><m:mn>2.4</m:mn></m:mrow><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/f01rjfe.f">Program Text (f01rjfe.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/f01rjfe.d">Program&#160;Data (f01rjfe.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/f01rjfe.r">Program Results (f01rjfe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/F01/f01rjf.pdf">F01RJF (PDF version)</a></div><div><a class="chap" href="f01conts.xml">F01 Chapter Contents</a></div><div><a class="chapint" href="f01intro.xml">F01 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>
