<?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>F02WGF : NAG Library, Mark 22</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a class="rout" href="../../pdf/F02/f02wgf.pdf">F02WGF (PDF version)</a></div><div><a class="chap" href="f02conts.xml">F02 Chapter Contents</a></div><div><a class="chapint" href="f02intro.xml">F02 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library Routine Document<br/><br/>F02WGF</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">F02WGF returns leading terms in the singular value decomposition (SVD) of a real general matrix and computes the corresponding left and right singular vectors.</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;F02WGF&#160;(</td><td class="tdfspec2"><a class="arg" href="#M">M</a>, <a class="arg" href="#N">N</a>, <a class="arg" href="#K">K</a>, <a class="arg" href="#NCV">NCV</a>, <a class="arg" href="#AV">AV</a>, <a class="arg" href="#NCONV">NCONV</a>, <a class="arg" href="#SIGMA">SIGMA</a>, <a class="arg" href="#U">U</a>, <a class="arg" href="#LDU">LDU</a>, <a class="arg" href="#V">V</a>, <a class="arg" href="#LDV">LDV</a>, <a class="arg" href="#RESID">RESID</a>, <a class="arg" href="#IUSER">IUSER</a>, <a class="arg" href="#RUSER">RUSER</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">M, N, K, NCV, NCONV, LDU, LDV, IUSER(*), IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">SIGMA(NCV), U(LDU,NCV), V(LDV,NCV), RESID(NCV), RUSER(*)</td></tr><tr><td class="tdfspec1">EXTERNAL</td><td class="tdfspec2">AV</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">F02WGF computes a few, <m:math><m:mi>k</m:mi></m:math>, of the largest singular values and corresponding vectors of an <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>. The value of <m:math><m:mi>k</m:mi></m:math>&#160;should be small relative to <m:math><m:mi>m</m:mi></m:math>&#160;and <m:math><m:mi>n</m:mi></m:math>, for example <m:math><m:mi>k</m:mi><m:mo>&#8764;</m:mo><m:mi>O</m:mi><m:mfenced separators=""><m:mrow><m:mi>min</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mi>m</m:mi><m:mo>,</m:mo><m:mi>n</m:mi></m:mfenced></m:mrow></m:mfenced></m:math>. The full singular value decomposition (SVD) of an <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 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:mi>U</m:mi><m:mi>&#931;</m:mi><m:msup><m:mi>V</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup>
  <m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

where <m:math><m:mi>U</m:mi></m:math>&#160;and <m:math><m:mi>V</m:mi></m:math>&#160;are orthogonal and <m:math><m:mi>&#931;</m:mi></m:math>&#160;is an <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;diagonal matrix with real diagonal elements, <m:math><m:msub><m:mi>&#963;</m:mi><m:mi>i</m:mi></m:msub></m:math>, such that

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
  <m:msub><m:mi>&#963;</m:mi><m:mn>1</m:mn></m:msub>
  <m:mo>&#8805;</m:mo>
  <m:msub><m:mi>&#963;</m:mi><m:mn>2</m:mn></m:msub>
  <m:mo>&#8805;</m:mo><m:mo>&#8943;</m:mo><m:mo>&#8805;</m:mo>
  <m:msub>
    <m:mi>&#963;</m:mi>
    <m:mrow><m:mi>min</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mi>m</m:mi><m:mo>,</m:mo><m:mi>n</m:mi></m:mfenced></m:mrow>
  </m:msub>
  <m:mo>&#8805;</m:mo>
  <m:mn>0</m:mn>
  <m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><div class="paramtext">The <m:math><m:msub><m:mi>&#963;</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;are the <span class="italic">singular values</span> of <m:math><m:mi>A</m:mi></m:math>&#160;and the first <m:math><m:mrow><m:mi>min</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mi>m</m:mi><m:mo>,</m:mo><m:mi>n</m:mi></m:mfenced></m:mrow></m:math>&#160;columns of <m:math><m:mi>U</m:mi></m:math>&#160;and <m:math><m:mi>V</m:mi></m:math>&#160;are the <span class="italic">left</span> and <span class="italic"> right singular vectors</span> of <m:math><m:mi>A</m:mi></m:math>.</div><div class="paramtext">If <m:math><m:msub><m:mi>U</m:mi><m:mi>k</m:mi></m:msub></m:math>, <m:math><m:msub><m:mi>V</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;denote the leading <m:math><m:mi>k</m:mi></m:math>&#160;columns of <m:math><m:mi>U</m:mi></m:math>&#160;and <m:math><m:mi>V</m:mi></m:math>&#160;respectively, and if <m:math><m:msub><m:mo>&#931;</m:mo><m:mi>k</m:mi></m:msub></m:math>&#160;denotes the leading principal submatrix of <m:math><m:mo>&#931;</m:mo></m:math>, then 

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:msub><m:mi>A</m:mi><m:mi>k</m:mi></m:msub>
 <m:mo>&#8801;</m:mo>
 <m:msub><m:mi>U</m:mi><m:mi>k</m:mi></m:msub>
 <m:msub><m:mo>&#931;</m:mo><m:mi>k</m:mi></m:msub>
 <m:msub><m:msup><m:mi>V</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>k</m:mi></m:msub>
</m:math></td><td class="formula2"/></tr></table></div>

is the best rank-<m:math><m:mi>k</m:mi></m:math>&#160;approximation to <m:math><m:mi>A</m:mi></m:math>&#160;in both the <m:math><m:mn>2</m:mn></m:math>-norm and the Frobenius norm.</div><div class="paramtext">The singular values and singular vectors satisfy

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>A</m:mi><m:msub><m:mi>v</m:mi><m:mi>i</m:mi></m:msub>
 <m:mo>=</m:mo>
 <m:msub><m:mi>&#963;</m:mi><m:mi>i</m:mi></m:msub>
 <m:msub><m:mi>u</m:mi><m:mi>i</m:mi></m:msub>
 <m:mtext>&#8195; and &#8195;</m:mtext>
 <m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:msub><m:mi>u</m:mi><m:mi>i</m:mi></m:msub>
 <m:mo>=</m:mo>
 <m:msub><m:mi>&#963;</m:mi><m:mi>i</m:mi></m:msub>
 <m:msub><m:mi>v</m:mi><m:mi>i</m:mi></m:msub>
 <m:mtext>&#8195; so that &#8195;</m:mtext>
 <m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>A</m:mi>
 <m:msub><m:mi>&#957;</m:mi><m:mi>i</m:mi></m:msub>
 <m:mo>=</m:mo>
 <m:msubsup><m:mi>&#963;</m:mi><m:mi>i</m:mi><m:mn>2</m:mn></m:msubsup>
 <m:msub><m:mi>&#957;</m:mi><m:mi>i</m:mi></m:msub>
 <m:mtext>&#8203; and &#8203;</m:mtext>
 <m:mi>A</m:mi>
 <m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup>
 <m:msub><m:mi>u</m:mi><m:mi>i</m:mi></m:msub>
 <m:mo>=</m:mo>
 <m:msubsup>
  <m:mi>&#963;</m:mi>
  <m:mi>i</m:mi>
  <m:mn>2</m:mn>
 </m:msubsup>
 <m:msub>
  <m:mi>u</m:mi>
  <m:mi>i</m:mi>
 </m:msub>
 <m:mtext>,</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

where <m:math><m:msub><m:mi>u</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>v</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;are the <m:math><m:mi>i</m:mi></m:math>th columns of <m:math><m:msub><m:mi>U</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>V</m:mi><m:mi>k</m:mi></m:msub></m:math>&#160;respectively.</div><div class="paramtext">Thus, for <m:math><m:mi>m</m:mi><m:mo>&#8805;</m:mo><m:mi>n</m:mi></m:math>, the largest singular values and corresponding right singular vectors are computed by finding eigenvalues and eigenvectors for the symmetric matrix <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>A</m:mi></m:math>. For <m:math><m:mi>m</m:mi><m:mo>&lt;</m:mo><m:mi>n</m:mi></m:math>, the largest singular values and corresponding left singular vectors are computed by finding eigenvalues and eigenvectors for the symmetric matrix <m:math><m:mi>A</m:mi><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup></m:math>. These eigenvalues and eigenvectors are found using routines from <a class="chap" href="../F12/f12conts.xml">Chapter F12</a>. You should read the <a class="chapint" href="../F12/f12intro.xml">F12 Chapter Introduction</a> for full details of the method used here.</div><div class="paramtext">The real matrix <m:math><m:mi>A</m:mi></m:math>&#160;is not explicitly supplied to F02WGF. Instead, you are required to supply a routine, <a class="arg" href="#AV">AV</a>, that must calculate one of the requested matrix-vector products <m:math><m:mi>A</m:mi><m:mi>x</m:mi></m:math>&#160;or <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>x</m:mi></m:math>&#160;for a given real vector <m:math><m:mi>x</m:mi></m:math>&#160;(of length <m:math><m:mi>n</m:mi></m:math>&#160;or <m:math><m:mi>m</m:mi></m:math>&#160;respectively).</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref115" id="ref115"/>Wilkinson J H (1978)  Singular Value Decomposition &#8211; Basic Aspects <i>Numerical Software &#8211; Needs and Availability</i> (ed D A H Jacobs) Academic Press </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>: 
<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 class="paramtext">If <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>, an immediate return is effected.</div></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:mn>0</m:mn></m:math>.<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, an immediate return is effected.</div></div></dd><dt class="paramhead"><a name="K" id="K"/>3: &#160;&#160;&#8194; K &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mi>k</m:mi></m:math>, the number of singular values to be computed.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:mn>0</m:mn><m:mo>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#K"><m:mi mathcolor="#EE0000" mathvariant="bold">K</m:mi></m:maction><m:mo>&lt;</m:mo><m:mrow><m:mi>min</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="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:math>.
</div>
</dd><dt class="paramhead"><a name="NCV" id="NCV"/>4: &#160;&#160;&#8194; NCV &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: 
the dimension of the arrays  <a class="arg" href="#SIGMA">SIGMA</a> and <a class="arg" href="#RESID">RESID</a> and the second dimension of the arrays  <a class="arg" href="#U">U</a> and <a class="arg" href="#V">V</a> as declared in the (sub)program from which F02WGF is called.This is the number of Lanczos basis vectors to use during the computation of the largest eigenvalues of <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>A</m:mi></m:math>&#160;(<m:math><m:mi>m</m:mi><m:mo>&#8805;</m:mo><m:mi>n</m:mi></m:math>) or <m:math><m:mi>A</m:mi><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup></m:math>&#160;(<m:math><m:mi>m</m:mi><m:mo>&lt;</m:mo><m:mi>n</m:mi></m:math>).
<div class="paramtext">At present there is no <span class="italic">a priori</span> analysis to guide the selection of <a class="arg" href="#NCV">NCV</a> relative to <a class="arg" href="#K">K</a>. However, it is recommended that <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCV"><m:mi mathcolor="#EE0000" mathvariant="bold">NCV</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>2</m:mn><m:mo>&#215;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#K"><m:mi mathcolor="#EE0000" mathvariant="bold">K</m:mi></m:maction><m:mo>+</m:mo><m:mn>1</m:mn></m:math>. If many problems of the same type are to be solved, you should experiment with varying <a class="arg" href="#NCV">NCV</a> while keeping <a class="arg" href="#K">K</a> fixed for a given test problem. This will usually decrease the required number of matrix-vector operations but it also increases the internal storage required to maintain the orthogonal basis vectors. The optimal &#8216;cross-over&#8217; with respect to CPU time is problem dependent and must be determined empirically.</div>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#K"><m:mi mathcolor="#EE0000" mathvariant="bold">K</m:mi></m:maction><m:mo>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCV"><m:mi mathcolor="#EE0000" mathvariant="bold">NCV</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mrow><m:mi>min</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="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>.
</div>
</dd><dt class="paramhead"><a name="AV" id="AV"/>5: &#160;&#160;&#8194; AV &#8211; SUBROUTINE, supplied by the user.<span class="pclass">External Procedure</span></dt><dd>
<div class="paramtext"><a class="arg" href="#AV">AV</a> must return the vector result of the matrix-vector product <m:math><m:mi>A</m:mi><m:mi>x</m:mi></m:math>&#160;or <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>x</m:mi></m:math>, as indicated by the input value of <a class="arg" href="../F02/f02wgf.xml#AV_IFLAG">IFLAG</a>, for the given vector <m:math><m:mi>x</m:mi></m:math>.</div>
<div class="paramtext"><a class="arg" href="#AV">AV</a> is called from F02WGF with the parameter <a class="arg" href="#IUSER">IUSER</a> and <a class="arg" href="#RUSER">RUSER</a> as supplied to F02WGF. You are free to use these arrays to supply information to <a class="arg" href="#AV">AV</a>.</div>
<div class="subprog">
<div class="paramtext">The specification of <a class="arg" href="#AV">AV</a> is:</div><table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;AV&#160;(</td><td class="tdfspec2"><a class="arg" href="../F02/f02wgf.xml#AV_IFLAG">IFLAG</a>, <a class="arg" href="../F02/f02wgf.xml#AV_M">M</a>, <a class="arg" href="../F02/f02wgf.xml#AV_N">N</a>, <a class="arg" href="../F02/f02wgf.xml#AV_X">X</a>, <a class="arg" href="../F02/f02wgf.xml#AV_AX">AX</a>, <a class="arg" href="../F02/f02wgf.xml#AV_IUSER">IUSER</a>, <a class="arg" href="../F02/f02wgf.xml#AV_RUSER">RUSER</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">IFLAG, M, N, IUSER(*)</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(*), AX(*), RUSER(*)</td></tr></table>
<dl><dt class="paramhead"><a name="AV_IFLAG" id="AV_IFLAG"/>1: &#160;&#160;&#8194; IFLAG &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>, <a class="arg" href="../F02/f02wgf.xml#AV_AX">AX</a> must return the <m:math><m:mi>m</m:mi></m:math>-vector result of the  matrix-vector product <m:math><m:mi>A</m:mi><m:mi>x</m:mi></m:math>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math>, <a class="arg" href="../F02/f02wgf.xml#AV_AX">AX</a> must return the <m:math><m:mi>n</m:mi></m:math>-vector result of the  matrix-vector product <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>x</m:mi></m:math>.</div>
</div>
<div class="paramtext"><i>On exit</i>: may be used as a flag to indicate a failure in the computation of <m:math><m:mi>A</m:mi><m:mi>x</m:mi></m:math>&#160;or <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>x</m:mi></m:math>. If <a class="arg" href="../F02/f02wgf.xml#AV_IFLAG">IFLAG</a> is negative on exit from <a class="arg" href="#AV">AV</a>, F02WGF will exit immediately with <a class="arg" href="#IFAIL">IFAIL</a> set to <a class="arg" href="../F02/f02wgf.xml#AV_IFLAG">IFLAG</a>.</div>
</dd><dt class="paramhead"><a name="AV_M" id="AV_M"/>2: &#160;&#160;&#8194; M &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the number of rows of the matrix <m:math><m:mi>A</m:mi></m:math>.</div>
</dd><dt class="paramhead"><a name="AV_N" id="AV_N"/>3: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd>
<div class="paramtext"><i>On entry</i>: the number of columns of the matrix <m:math><m:mi>A</m:mi></m:math>.</div>
</dd><dt class="paramhead"><a name="AV_X" id="AV_X"/>4: &#160;&#160;&#8194; X(<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="../F02/f02wgf.xml#AV_X">X</a>
is
<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;and at least <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math>.</div>
<div class="paramtext"><i>On entry</i>: the vector to be pre-multiplied by the matrix <m:math><m:mi>A</m:mi></m:math>&#160;or <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup></m:math>.</div>
</dd><dt class="paramhead"><a name="AV_AX" id="AV_AX"/>5: &#160;&#160;&#8194; AX(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="../F02/f02wgf.xml#AV_AX">AX</a>
is
<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_M"><m:mi mathcolor="#EE0000" mathvariant="bold">M</m:mi></m:maction></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;and at least <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math>.</div>
<div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>, contains the <m:math><m:mi>m</m:mi></m:math>-vector result of the matrix-vector product <m:math><m:mi>A</m:mi><m:mi>x</m:mi></m:math>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#AV_IFLAG"><m:mi mathcolor="#EE0000" mathvariant="bold">IFLAG</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math>, contains the <m:math><m:mi>n</m:mi></m:math>-vector result of the matrix-vector product <m:math><m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup><m:mi>x</m:mi></m:math>.</div>
</div>
</dd><dt class="paramhead"><a name="AV_IUSER" id="AV_IUSER"/>6: &#160;&#160;&#8194; IUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">User Workspace</span></dt><dt class="multi-paramhead"><a name="AV_RUSER" id="AV_RUSER"/>7: &#160;&#160;&#8194; RUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">User Workspace</span></dt></dl>
</div>
<div class="paramtext"><a class="arg" href="#AV">AV</a> must be declared as EXTERNAL in the (sub)program from which F02WGF is called. Parameters denoted as <span class="italic">Input</span>  must <b>not</b>  be changed by this procedure.</div>
</dd><dt class="paramhead"><a name="NCONV" id="NCONV"/>6: &#160;&#160;&#8194; NCONV &#8211; INTEGER<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the number of converged singular values found.</div>
</dd><dt class="paramhead"><a name="SIGMA" id="SIGMA"/>7: &#160;&#160;&#8194; SIGMA(<a class="arg" href="#NCV">NCV</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the <a class="arg" href="#NCONV">NCONV</a> converged singular values are stored in the first <a class="arg" href="#NCONV">NCONV</a> elements of <a class="arg" href="#SIGMA">SIGMA</a>.</div>
</dd><dt class="paramhead"><a name="U" id="U"/>8: &#160;&#160;&#8194; U(<a class="arg" href="#LDU">LDU</a>,<a class="arg" href="#NCV">NCV</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the left singular vectors corresponding to the singular values stored in <a class="arg" href="#SIGMA">SIGMA</a>.
<div class="paramtext">The <m:math><m:mi>i</m:mi></m:math>th element of the <m:math><m:mi>j</m:mi></m:math>th left singular vector <m:math><m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;is stored in <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#U"><m:mi mathcolor="#EE0000" mathvariant="bold">U</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>m</m:mi></m:math>&#160;and <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCONV"><m:mi mathcolor="#EE0000" mathvariant="bold">NCONV</m:mi></m:maction></m:math>.</div>
</div>
</dd><dt class="paramhead"><a name="LDU" id="LDU"/>9: &#160;&#160;&#8194; LDU &#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="#U">U</a> as declared in the (sub)program from which F02WGF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDU"><m:mi mathcolor="#EE0000" mathvariant="bold">LDU</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="V" id="V"/>10: &#8194; V(<a class="arg" href="#LDV">LDV</a>,<a class="arg" href="#NCV">NCV</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the right singular vectors corresponding to the singular values stored in <a class="arg" href="#SIGMA">SIGMA</a>.
<div class="paramtext">The <m:math><m:mi>i</m:mi></m:math>th element of the <m:math><m:mi>j</m:mi></m:math>th right singular vector <m:math><m:msub><m:mi>v</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;is stored in <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#V"><m:mi mathcolor="#EE0000" mathvariant="bold">V</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi><m:mi>j</m:mi></m:mfenced></m:mrow></m:math>, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>&#160;and <m:math><m:mi>j</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#NCONV"><m:mi mathcolor="#EE0000" mathvariant="bold">NCONV</m:mi></m:maction></m:math>.</div>
</div>
</dd><dt class="paramhead"><a name="LDV" id="LDV"/>11: &#8194; LDV &#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="#V">V</a> as declared in the (sub)program from which F02WGF is called.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#LDV"><m:mi mathcolor="#EE0000" mathvariant="bold">LDV</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mrow><m:mi>max</m:mi><m:mspace width="0.125em"/><m:mfenced separators=""><m:mn>1</m:mn><m:mo>,</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>.
</div>
</dd><dt class="paramhead"><a name="RESID" id="RESID"/>12: &#8194; RESID(<a class="arg" href="#NCV">NCV</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the residual 
<m:math>
  <m:mfenced open="&#8214;" close="&#8214;" separators="">
    <m:mi>A</m:mi>
    <m:msub><m:mi>v</m:mi><m:mi>j</m:mi></m:msub>
    <m:mo>-</m:mo>
    <m:msub><m:mi>&#963;</m:mi><m:mi>j</m:mi></m:msub>
    <m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub>
  </m:mfenced>
</m:math>, for <m:math><m:mi>m</m:mi><m:mo>&#8805;</m:mo><m:mi>n</m:mi></m:math>, or <m:math>
  <m:mfenced open="&#8214;" close="&#8214;" separators="">
    <m:msup><m:mi>A</m:mi><m:mi mathvariant="normal">T</m:mi></m:msup>
    <m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub>
    <m:mo>-</m:mo>
    <m:msub><m:mi>&#963;</m:mi><m:mi>j</m:mi></m:msub>
    <m:msub><m:mi>v</m:mi><m:mi>j</m:mi></m:msub>
  </m:mfenced>
</m:math>, for <m:math><m:mi>m</m:mi><m:mo>&lt;</m:mo><m:mi>n</m:mi></m:math>, for each of the converged singular values <m:math><m:msub><m:mi>&#963;</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;and corresponding left and right singular vectors <m:math><m:msub><m:mi>u</m:mi><m:mi>j</m:mi></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>v</m:mi><m:mi>j</m:mi></m:msub></m:math>.</div>
</dd><dt class="paramhead"><a name="IUSER" id="IUSER"/>13: &#8194; IUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">User Workspace</span></dt><dd>
<div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#IUSER">IUSER</a>
must be at least
<m:math><m:mn>1</m:mn></m:math>.</div>
<div class="paramtext"><a class="arg" href="#IUSER">IUSER</a> is not used by F02WGF, but is passed directly to <a class="arg" href="#AV">AV</a>. It may be used to pass information to and from this routine.</div>
</dd><dt class="paramhead"><a name="RUSER" id="RUSER"/>14: &#8194; RUSER(<m:math><m:mo>*</m:mo></m:math>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">User Workspace</span></dt><dd>
<div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#RUSER">RUSER</a>
must be at least
<m:math><m:mn>1</m:mn></m:math>.</div>
<div class="paramtext"><a class="arg" href="#RUSER">RUSER</a> is not used by F02WGF, but is passed directly to <a class="arg" href="#AV">AV</a>. It may be used to pass information to and from this routine.</div>
</dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>15: &#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><div class="paramtext">F02WGF returns with <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;if at least <m:math><m:mi>k</m:mi></m:math>&#160;singular values have converged and the corresponding left and right singular vectors have been computed.</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="IFlt0" id="IFlt0"/><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>&lt;</m:mo><m:mn>0</m:mn></m:math></dt>
<dd>
<div class="paramtext"><a class="arg" href="../F02/f02wgf.xml#AV_IFLAG">IFLAG</a> was set to a negative value following a call to <a class="arg" href="#AV">AV</a>.</div>
</dd>
</dl>
<dl class="ifail">
<dt class="errorhead"><a name="IFeq1" id="IFeq1"/><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></table>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq2" id="IFeq2"/><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>2</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="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>.</td></tr></table>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq3" id="IFeq3"/><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>3</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="#K"><m:mi mathcolor="#EE0000" mathvariant="bold">K</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0</m:mn></m:math>.</td></tr></table>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq4" id="IFeq4"/><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>4</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="#NCV"><m:mi mathcolor="#EE0000" mathvariant="bold">NCV</m:mi></m:maction><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#K"><m:mi mathcolor="#EE0000" mathvariant="bold">K</m:mi></m:maction><m:mo>+</m:mo><m:mn>1</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="#NCV"><m:mi mathcolor="#EE0000" mathvariant="bold">NCV</m:mi></m:maction><m:mo>&gt;</m:mo><m:mrow><m:mi>min</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="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:mfenced></m:mrow></m:math>.</td></tr></table>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq5" id="IFeq5"/><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>5</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="#LDU"><m:mi mathcolor="#EE0000" mathvariant="bold">LDU</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><dl class="ifail">
<dt class="errorhead"><a name="IFeq6" id="IFeq6"/><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>6</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="#LDV"><m:mi mathcolor="#EE0000" mathvariant="bold">LDV</m:mi></m:maction><m:mo>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>.</td></tr></table>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq7" id="IFeq7"/><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>7</m:mn></m:math></dt>
<dd>
<div class="paramtext">No converged singular values were found to sufficient accuracy.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq8" id="IFeq8"/><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>8</m:mn></m:math></dt>
<dd>
<div class="paramtext">The internal maximum number of iterations has been reached.  Some singular values may have converged.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq9" id="IFeq9"/><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>9</m:mn></m:math></dt>
<dt class="multi-errorhead"><a name="IFeq10" id="IFeq10"/><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>10</m:mn></m:math></dt>
<dt class="multi-errorhead"><a name="IFeq20" id="IFeq20"/><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>20</m:mn></m:math></dt>
<dd>
<div class="paramtext">An error occurred during an internal call.  Consider increasing the size of <a class="arg" href="#NCV">NCV</a> relative to <a class="arg" href="#K">K</a>.</div>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">See <a class="sec" href="../F08/f08intro.xml#background112">Section 2.14.2</a> in  the F08 Chapter Introduction.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">None.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example finds the four largest singular values (<m:math><m:mi>&#963;</m:mi></m:math>) and corresponding right and left singular vectors for the matrix <m:math><m:mi>A</m:mi></m:math>, where <m:math><m:mi>A</m:mi></m:math>&#160;is the <m:math><m:mi>m</m:mi></m:math>&#160;by <m:math><m:mi>n</m:mi></m:math>&#160;real matrix derived from the simplest finite difference discretization of the two-dimensional kernal <m:math><m:mi>k</m:mi><m:mfenced separators=""><m:mi>s</m:mi><m:mo>,</m:mo><m:mi>t</m:mi></m:mfenced><m:mrow><m:mi>d</m:mi><m:mi>t</m:mi></m:mrow></m:math>&#160;where

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>k</m:mi><m:mfenced separators=""><m:mi>s</m:mi><m:mo>,</m:mo><m:mi>t</m:mi></m:mfenced>
 <m:mo>=</m:mo>
 <m:mfenced open="{" close="" separators="">
  <m:mtable>
   <m:mtr>
    <m:mtd><m:mi>s</m:mi><m:mfenced separators=""><m:mi>t</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mfenced></m:mtd>
    <m:mtd><m:mtext>if &#8203;</m:mtext><m:mn>0</m:mn><m:mo>&#8804;</m:mo><m:mi>s</m:mi><m:mo>&#8804;</m:mo><m:mi>t</m:mi><m:mo>&#8804;</m:mo><m:mn>
1</m:mn></m:mtd>
   </m:mtr><m:mtr>
    <m:mtd><m:mi>t</m:mi><m:mfenced separators=""><m:mi>s</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mfenced></m:mtd>
    <m:mtd><m:mtext>if &#8203;</m:mtext><m:mn>0</m:mn><m:mo>&#8804;</m:mo><m:mi>t</m:mi><m:mo>&lt;</m:mo><m:mi>s</m:mi><m:mo>&#8804;</m:mo><m:mn>1
</m:mn></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/f02wgfe.f">Program Text (f02wgfe.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/f02wgfe.d">Program&#160;Data (f02wgfe.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/f02wgfe.r">Program Results (f02wgfe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/F02/f02wgf.pdf">F02WGF (PDF version)</a></div><div><a class="chap" href="f02conts.xml">F02 Chapter Contents</a></div><div><a class="chapint" href="f02intro.xml">F02 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div>
<div><hr/><a class="genint" href="../FRONTMATTER/copyright.xml">&#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2009</a></div></body></html>
