<?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>F01QKF : 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/f01qkf.pdf">F01QKF (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/>F01QKF</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">F01QKF returns the first <m:math><m:mi>&#8467;</m:mi></m:math>&#160;rows of the real <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;orthogonal matrix  <m:math><m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup></m:math>, where <m:math><m:mi>P</m:mi></m:math>&#160;is given as the product of Householder transformation matrices.</div><div class="paramtext">This routine is intended for use following <a class="rout" href="../F01/f01qjf.xml">F01QJF</a>.</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;F01QKF&#160;(</td><td class="tdfspec2"><a class="arg" href="#WHERET">WHERET</a>, <a class="arg" href="#M">M</a>, <a class="arg" href="#N">N</a>, <a class="arg" href="#NROWP">NROWP</a>, <a class="arg" href="#A">A</a>, <a class="arg" href="#LDA">LDA</a>, <a class="arg" href="#ZETA">ZETA</a>, <a class="arg" href="#WORK">WORK</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">M, N, NROWP, LDA, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">A(LDA,*), ZETA(*), WORK(max(M-1,NROWP-M,1))</td></tr><tr><td class="tdfspec1">CHARACTER*1</td><td class="tdfspec2">WHERET</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext"><m:math><m:mi>P</m:mi></m:math>&#160;is assumed to be given by

<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:msub><m:mi>P</m:mi><m:mrow><m:mi>m</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msub><m:mo>&#8943;</m:mo><m:msub><m:mi>P</m:mi><m:mn>1</m:mn></m:msub>
</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:mtable>
 <m:mtr>
  <m:mtd>
   <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>u</m:mi><m:mi>k</m:mi></m:msub>
   <m:msubsup><m:mi>u</m:mi><m:mi>k</m:mi><m:mi mathvariant="normal">T</m:mi></m:msubsup>
   <m:mtext>,</m:mtext>
  </m:mtd>
 </m:mtr><m:mtr>
  <m:mtd/>
 </m:mtr><m:mtr>
  <m:mtd><m:msub><m:mi>u</m:mi><m:mi>k</m:mi></m:msub><m:mo>=</m:mo><m:mfenced><m:mtable>
     <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:mtd>
 </m:mtr>
</m:mtable>
</m:math></td><td class="formula2"/></tr></table></div><m:math><m:msub><m:mi>&#950;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;is a 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:mi>k</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:math>) 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:mi>n</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:math>) element vector.  <m:math><m:msub><m:mi>w</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;must be supplied in the <m:math><m:mi>k</m:mi></m:math>th row of <a class="arg" href="#A">A</a> in elements  <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>.  <m:math><m:msub><m:mi>z</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;must be supplied in the <m:math><m:mi>k</m:mi></m:math>th row of <a class="arg" href="#A">A</a> in elements  <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>&#160;and  <m:math><m:msub><m:mi>&#950;</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;must be supplied either 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:mi>k</m:mi></m:mfenced></m:mrow></m:math>&#160;or in <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#ZETA"><m:mi mathcolor="#EE0000" mathvariant="bold">ZETA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>k</m:mi></m:mfenced></m:mrow></m:math>, depending upon the parameter <a class="arg" href="#WHERET">WHERET</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="WHERET" id="WHERET"/>1: &#160;&#160;&#8194; WHERET &#8211; CHARACTER*1<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: indicates where the elements of <m:math><m:mi>&#950;</m:mi></m:math>&#160;are to be found.

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math>&#160;(In <a class="arg" href="#A">A</a>)</dt>
<dd>The elements of <m:math><m:mi>&#950;</m:mi></m:math>&#160;are in <a class="arg" href="#A">A</a>.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>&#160;(Separate)</dt>
<dd>The elements of <m:math><m:mi>&#950;</m:mi></m:math>&#160;are separate from <a class="arg" href="#A">A</a>, in <a class="arg" href="#ZETA">ZETA</a>.</dd></dl>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction></m:math>&#160;must be one of 'I' or 'S'.</div></dd><dt class="paramhead"><a name="M" id="M"/>2: &#160;&#160;&#8194; M &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <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><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"/>3: &#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="NROWP" id="NROWP"/>4: &#160;&#160;&#8194; NROWP &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mi>&#8467;</m:mi></m:math>, the required number of rows of <m:math><m:mi>P</m:mi></m:math>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, an immediate return is effected.</div>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:mn>0</m:mn><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>.
</div></dd><dt class="paramhead"><a name="A" id="A"/>5: &#160;&#160;&#8194; A(<a class="arg" href="#LDA">LDA</a>,<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</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>m</m:mi></m:math>&#160;strictly lower triangular part of the array <a class="arg" href="#A">A</a>, and the <m:math><m:mi>m</m:mi></m:math>&#160;by (<m:math><m:mi>n</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:math>) rectangular part of <a class="arg" href="#A">A</a> with top left-hand corner at element <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:mn>1</m:mn><m:mrow><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>1</m:mn></m:mrow></m:mfenced></m:mrow></m:math>&#160;must contain details of the matrix <m:math><m:mi>P</m:mi></m:math>. In addition, when <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math>, then the diagonal elements of <a class="arg" href="#A">A</a> must contain the elements of <m:math><m:mi>&#950;</m:mi></m:math>.</div>
<div class="paramtext"><i>On exit</i>: the first <a class="arg" href="#NROWP">NROWP</a> rows of the array <a class="arg" href="#A">A</a> are overwritten by the first <a class="arg" href="#NROWP">NROWP</a> rows of the <m:math><m:mi>n</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;orthogonal matrix <m:math><m:msup><m:mi>P</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup></m:math>.</div></dd><dt class="paramhead"><a name="LDA" id="LDA"/>6: &#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 F01QKF 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:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction></m:mfenced></m:mrow></m:math>.
</div></dd><dt class="paramhead"><a name="ZETA" id="ZETA"/>7: &#160;&#160;&#8194; ZETA(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#ZETA">ZETA</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="#M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction></m:mfenced></m:mrow></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>, and at least <m:math><m:mn>1</m:mn></m:math>&#160;otherwise.</div>
<div class="paramtext"><i>On entry</i>: with <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'S'</m:mtext></m:math>, the array <a class="arg" href="#ZETA">ZETA</a> must contain the elements of <m:math><m:mi>&#950;</m:mi></m:math>. If <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#ZETA"><m:mi mathcolor="#EE0000" mathvariant="bold">ZETA</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>&#160;then <m:math><m:msub><m:mi>P</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;is assumed to be <m:math><m:mi>I</m:mi></m:math>, otherwise <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#ZETA"><m:mi mathcolor="#EE0000" mathvariant="bold">ZETA</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>k</m:mi></m:mfenced></m:mrow></m:math>&#160;is assumed to contain <m:math><m:msub><m:mi>&#950;</m:mi><m:mi>k</m:mi></m:msub></m:math>.
<div class="paramtext">When <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'I'</m:mtext></m:math>, the array <a class="arg" href="#ZETA">ZETA</a> is not referenced.</div>
</div></dd><dt class="paramhead"><a name="WORK" id="WORK"/>8: &#160;&#160;&#8194; WORK(<m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mrow><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>1</m:mn></m:mrow><m:mo>,</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction><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:mrow><m:mo>,</m:mo><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Workspace</span></dt><dd><div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#WORK">WORK</a>
must be at least
<m:math><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mrow><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>1</m:mn></m:mrow><m:mo>,</m:mo><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction><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:mrow><m:mo>,</m:mo><m:mn>1</m:mn></m:mfenced></m:mrow></m:math>.</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>9: &#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="#WHERET"><m:mi mathcolor="#EE0000" mathvariant="bold">WHERET</m:mi></m:maction><m:mo>&#8800;</m:mo><m:mtext>'I'</m:mtext></m:math>&#160;or <m:math><m:mtext>'S'</m:mtext></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="#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="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction><m:mo>&gt;</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>,</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:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><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:maction actiontype="link" dsi:type="simple" dsi:href="#NROWP"><m:mi mathcolor="#EE0000" mathvariant="bold">NROWP</m:mi></m:maction></m:mfenced></m:mrow></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 matrix <m:math><m:mi>P</m:mi></m:math>&#160;satisfies the relation

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>P</m:mi><m:mo>=</m:mo><m:mi>Q</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 <m:math><m:mi>Q</m:mi></m:math>&#160;is an exactly orthogonal matrix and

<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: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>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.  See also  <a class="sec" href="../F01/f01qjf.xml#accuracy">Section 7</a> in F01QJF.</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

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mtable columnalign="left">
 <m:mtr>
  <m:mtd><m:mfrac other="small"><m:mn>2</m:mn><m:mn>3</m:mn></m:mfrac><m:mi>m</m:mi><m:mfenced open="{" close="}" separators=""><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:mfenced separators=""><m:mn>2</m:mn><m:mi>&#8467;</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:mfenced><m:mo>-</m:mo><m:mi>m</m:mi><m:mfenced separators=""><m:mi>&#8467;</m:mi><m:mo>-</m:mo><m:mi>m</m:mi></m:mfenced></m:mfenced><m:mtext>,</m:mtext></m:mtd>
  <m:mtd><m:mtext>if &#8203;</m:mtext><m:mi>&#8467;</m:mi><m:mo>&#8805;</m:mo><m:mi>m</m:mi><m:mtext>, and &#8203;</m:mtext></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd/>
  <m:mtd/></m:mtr><m:mtr>
  <m:mtd><m:mfrac other="small"><m:mn>2</m:mn><m:mn>3</m:mn></m:mfrac><m:msup><m:mi>&#8467;</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>&#8467;</m:mi></m:mfenced><m:mtext>,</m:mtext></m:mtd>
  <m:mtd><m:mtext>if &#8203;</m:mtext><m:mi>&#8467;</m:mi><m:mo>&lt;</m:mo><m:mi>m</m:mi><m:mtext>.</m:mtext></m:mtd>
 </m:mtr>
</m:mtable>
</m:math></td><td class="formula2"/></tr></table></div></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:mn>5</m:mn></m:math>&#160;by <m:math><m:mn>5</m:mn></m:math>&#160;orthogonal matrix <m:math><m:mi>P</m:mi></m:math>&#160;following 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 <m:math><m:mi>A</m:mi></m:math>&#160;given by

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>A</m:mi><m:mo>=</m:mo><m:mfenced><m:mtable columnalign="right">
  <m:mtr>
   <m:mtd><m:mn>2.0</m:mn></m:mtd>
   <m:mtd><m:mn>2.0</m:mn></m:mtd>
   <m:mtd><m:mn>1.6</m:mn></m:mtd>
   <m:mtd><m:mn>2.0</m:mn></m:mtd>
   <m:mtd><m:mn>1.2</m:mn></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd><m:mn>2.5</m:mn></m:mtd>
   <m:mtd><m:mn>2.5</m:mn></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>0.4</m:mn></m:mrow></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>0.5</m:mn></m:mrow></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>0.3</m:mn></m:mrow></m:mtd>
  </m:mtr><m:mtr>
   <m:mtd><m:mn>2.5</m:mn></m:mtd>
   <m:mtd><m:mn>2.5</m:mn></m:mtd>
   <m:mtd><m:mn>2.8</m:mn></m:mtd>
   <m:mtd><m:mn>0.5</m:mn></m:mtd>
   <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>2.9</m:mn></m:mrow></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/f01qkfe.f">Program Text (f01qkfe.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/f01qkfe.d">Program&#160;Data (f01qkfe.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/f01qkfe.r">Program Results (f01qkfe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/F01/f01qkf.pdf">F01QKF (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>
