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

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xml:space="preserve"><head><title>
  NAG C Library, Mark 7 : 
  f04</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a href="../../pdf/F04/f04_intro.pdf">f04 Chapter Introduction (pdf version)</a></div><div><a href="f04_conts.xml">Chapter Contents</a></div>
<div><a href="../mark7.xml">NAG C Library Contents</a></div><hr/><h1 class="libdoc">NAG C Library  Chapter Introduction<br/><br/>f04 &#8212; Simultaneous Linear Equations</h1>
<div class="toc"><h3>Contents</h3>
<h2 class="toc"><a class="rtnref" href="#scope">1&#160;&#160;Scope of the Chapter</a></h2>
<h2 class="toc"><a class="rtnref" href="#background">2&#160;&#160;Background to the Problems</a></h2>
<h3 class="toc"><a class="rtnref" href="#background1">2.1&#160;&#160;Unique Solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>=</mo><mi>b</mi></math></a></h3>
<h3 class="toc"><a class="rtnref" href="#background2">2.2&#160;&#160;The Least-squares Solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>&#8771;</mo><mi>b</mi></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>&gt;</mo><mi>n</mi></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>rank</mi><mo>&#8289;</mo><mi>A</mi></mrow><mo>=</mo><mi>n</mi></math></a></h3>
<h3 class="toc"><a class="rtnref" href="#background3">2.3&#160;&#160;Rank-deficient Cases</a></h3>
<h3 class="toc"><a class="rtnref" href="#background4">2.4&#160;&#160;The Rank of a Matrix</a></h3>
<h3 class="toc"><a class="rtnref" href="#background5">2.5&#160;&#160;Generalized Linear Least-squares Problems</a></h3>
<h3 class="toc"><a class="rtnref" href="#background6">2.6&#160;&#160;Calculating the Inverse of a Matrix</a></h3>
<h2 class="toc"><a class="rtnref" href="#available">3&#160;&#160;Recommendations on Choice and Use of Available Functions</a></h2>
<h3 class="toc"><a class="rtnref" href="#recomm_1">3.1&#160;&#160;Black Box and General Purpose Functions</a></h3>
<h3 class="toc"><a class="rtnref" href="#recomm_2">3.2&#160;&#160;Systems of Linear Equations</a></h3>
<h3 class="toc"><a class="rtnref" href="#recomm_3">3.3&#160;&#160;Linear Least-squares Problems</a></h3>
<h3 class="toc"><a class="rtnref" href="#recomm_4">3.4&#160;&#160;Sparse Matrix Functions</a></h3>
<h2 class="toc"><a class="rtnref" href="#dtree">4&#160;&#160;Decision Trees</a></h2>
<h2 class="toc"><a class="rtnref" href="#index">5&#160;&#160;Index</a></h2>
<h2 class="toc"><a class="rtnref" href="#withdrawn">6&#160;&#160;Functions Withdrawn or Scheduled for Withdrawal</a></h2>
<h2 class="toc"><a class="rtnref" href="#references">7&#160;&#160;References</a></h2></div>




<h2><a name="scope" id="scope"/>1&#160;&#160;Scope of the Chapter</h2>

<div class="paramtext">This chapter is concerned with the solution of the matrix equation <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>X</mi><mo>=</mo><mi>B</mi></math>, where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi></math>&#160;may be a single vector or  a matrix of multiple right-hand sides.  The matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;may  be real, complex, symmetric, Hermitian, positive-definite, positive-definite  Toeplitz or banded.  It may also be rectangular, in which case a  least-squares solution is obtained.</div>
<div class="paramtext">For a general introduction to sparse systems of equations,  see the <a class="secref" href="../F11/f11_intro.xml">f11</a> Chapter Introduction, which

provides functions for sparse

systems.

</div>





<h2><a name="background" id="background"/>2&#160;&#160;Background to the Problems</h2>

<div class="paramtext">A set of linear equations may be written in the form
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>A</mi><mi>x</mi><mo>=</mo><mi>b</mi>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
where the known matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>, with real or complex coefficients,  is of size <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>, (<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;rows and  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;columns), the known right-hand vector <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;has  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;components (<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;rows and one column), and the  required solution vector <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;has <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;components  (<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;rows and one column).  There may also be <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>&#160; vectors <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>b</mi><mi>i</mi></msub></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>i</mi><mo>=</mo><mn>1</mn><mo>,</mo><mn>2</mn><mo>,</mo><mo>&#8230;</mo><mo>,</mo><mi>p</mi></math>&#160;on the right-hand  side and the equations may then be written as
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>A</mi><mi>X</mi><mo>=</mo><mi>B</mi><mtext>,</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
the required matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>X</mi></math>&#160;having as its <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>&#160;columns  the solutions of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><msub><mi>x</mi><mi>i</mi></msub><mo>=</mo><msub><mi>b</mi><mi>i</mi></msub></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>i</mi><mo>=</mo><mn>1</mn><mo>,</mo><mn>2</mn><mo>,</mo><mo>&#8230;</mo><mo>,</mo><mi>p</mi></math>.  Some functions deal with the latter case, but for clarity only the case  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi><mo>=</mo><mn>1</mn></math>&#160;is discussed here.</div>
<div class="paramtext">The most common problem, the determination of the unique solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>=</mo><mi>b</mi></math>, occurs when <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>=</mo><mi>n</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160; is not singular, that is <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>rank</mi><mo>&#8289;</mo><mfenced separators=""><mi>A</mi></mfenced></mrow><mo>=</mo><mi>n</mi></math>.  This is discussed  in Section <a class="secref" href="#background1">2.1</a> below.  The next most common problem,  discussed in Section <a class="secref" href="#background2">2.2</a> below, is the determination  of the least-squares solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>&#8771;</mo><mi>b</mi></math>&#160;required when  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>&gt;</mo><mi>n</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>rank</mi><mo>&#8289;</mo><mfenced separators=""><mi>A</mi></mfenced></mrow><mo>=</mo><mi>n</mi></math>, i.e., the  determination of the vector <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;which minimizes the norm of  the residual vector <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mi>b</mi><mo>-</mo><mi>A</mi><mi>x</mi></math>.  All other cases are rank  deficient, and they are treated in Section <a class="secref" href="#background3">2.3</a>.</div>
<div class="paramtext">Most of the functions of the chapter are based on those published in the book edited by <a class="litref" href="#ref103">Wilkinson  and Reinsch (1971)</a>.  We are very grateful to the late Dr J H Wilkinson FRS for his help and interest during the implementation of this chapter of the Library.</div>


<h3><a name="background1" id="background1"/>2.1&#160;&#160;Unique Solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>=</mo><mi>b</mi></math></h3>

<div class="paramtext">Most functions in this chapter solve this particular problem.  The computation starts with the triangular decomposition <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mo>=</mo><mi>P</mi><mi>L</mi><mi>U</mi></math>,  where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;are respectively lower and upper  triangular matrices and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi></math>&#160;is a permutation matrix, chosen so  as to ensure that the decomposition is numerically stable.  The solution is  then obtained by solving in succession the simpler equations
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mtable columnalign="left center left">
 <mtr>
  <mtd><mi>L</mi><mi>y</mi></mtd>
  <mtd><mo>=</mo></mtd>
  <mtd><msup><mi>P</mi><mi mathvariant="italic">T</mi></msup><mi>b</mi></mtd>
 </mtr><mtr>
  <mtd><mi>U</mi><mi>x</mi></mtd>
  <mtd><mo>=</mo></mtd>
  <mtd><mi>y</mi></mtd>
 </mtr>
</mtable>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
the first by forward-substitution and the second by back-substitution.</div>
<div class="paramtext">If <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is real symmetric and positive-definite,  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi><mo>=</mo><msup><mi>L</mi><mi mathvariant="italic">T</mi></msup></math>, while if <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is complex Hermitian  and positive-definite, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi><mo>=</mo><msup><mi>L</mi><mi mathvariant="italic">H</mi></msup></math>; in both these cases  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi></math>&#160;is the identity matrix (i.e., no permutations are necessary).  In all other cases either <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math>&#160;or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>L</mi></math>&#160;has unit  diagonal elements.</div>
<div class="paramtext">Due to rounding errors the computed &#8216;solution&#8217;
<math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>x</mi><mn>0</mn></msub></math>, say, is only an approximation to the true solution <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>.  This approximation will sometimes be satisfactory, agreeing with <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;to several figures, but if the problem is ill-conditioned then <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>x</mi><mn>0</mn></msub></math>&#160;may have few or even no figures in common, and at this stage there is no means of estimating the &#8216;accuracy&#8217; of <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>x</mi><mn>0</mn></msub></math>.</div>


<div class="paramtext">It must be emphasised that the &#8216;true&#8217; solution <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;may  not be meaningful, that is correct to all figures quoted, if the elements  of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;are known with certainty only to  say <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>&#160;figures, where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>&#160;is smaller than the  word-length of the computer.

</div>
<div class="paramtext">

One
approach to assessing the accuracy of the solution is to compute or estimate the <b>condition number</b> of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>,  defined as
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced><mo>=</mo><mfenced open="&#8214;" close="&#8214;" separators=""><mi>A</mi></mfenced><mfenced open="&#8214;" close="&#8214;" separators=""><msup><mi>A</mi><mrow><mo>-</mo><mn>1</mn></mrow></msup></mfenced><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
Roughly speaking, errors or uncertainties in <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;or  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;may be amplified in the solution by a factor  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced></math>.  Thus, for example, if the data in  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;are only accurate to 5 digits  and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced><mo>&#8776;</mo><msup><mn>10</mn><mn>3</mn></msup></math>, then the solution  cannot be guaranteed to have more than 2 correct digits.  If  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced><mo>&#8805;</mo><msup><mn>10</mn><mn>5</mn></msup></math>, the solution may have  no meaningful digits.</div>
<div class="paramtext">To be more precise, suppose that
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>A</mi><mi>x</mi><mo>=</mo><mi>b</mi><mtext>&#8195;&#160;and&#160;&#8195;</mtext><mfenced separators=""><mi>A</mi><mo>+</mo><mi>&#948;</mi><mi>A</mi></mfenced><mfenced separators=""><mi>x</mi><mo>+</mo><mi>&#948;</mi><mi>x</mi></mfenced><mo>=</mo><mi>b</mi><mo>+</mo><mi>&#948;</mi><mi>b</mi><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
Here <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#948;</mi><mi>A</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#948;</mi><mi>b</mi></math>&#160;represent  perturbations to the matrices <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160; which cause a perturbation <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#948;</mi><mi>x</mi></math>&#160;in the solution.  We can define measures of the relative sizes of the perturbations in  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;as
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<msub><mi>&#961;</mi><mi>A</mi></msub><mo>=</mo><mfrac><mrow><mfenced open="&#8214;" close="&#8214;" separators=""><mi>&#948;</mi><mi>A</mi></mfenced></mrow><mrow><mfenced open="&#8214;" close="&#8214;" separators=""><mi>A</mi></mfenced></mrow></mfrac><mtext>,&#160;&#8195;</mtext><msub><mi>&#961;</mi><mi>b</mi></msub><mo>=</mo><mfrac><mrow><mfenced open="&#8214;" close="&#8214;" separators=""><mi>&#948;</mi><mi>b</mi></mfenced></mrow><mrow><mfenced open="&#8214;" close="&#8214;" separators=""><mi>b</mi></mfenced></mrow></mfrac><mtext>&#8195;&#160;and&#160;&#8195;</mtext><msub><mi>&#961;</mi><mi>x</mi></msub><mo>=</mo><mfrac><mrow><mfenced open="&#8214;" close="&#8214;" separators=""><mi>&#948;</mi><mi>x</mi></mfenced></mrow><mrow><mfenced open="&#8214;" close="&#8214;" separators=""><mi>x</mi></mfenced></mrow></mfrac><mtext>&#8195;&#160;respectively.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
Then
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<msub><mi>&#961;</mi><mi>x</mi></msub><mo>&#8804;</mo><mfrac><mrow><mi>&#954;</mi> <mfenced separators=""><mi>A</mi></mfenced></mrow><mrow><mn>1</mn><mo>-</mo><mi>&#954;</mi> <mfenced separators=""><mi>A</mi></mfenced><msub><mi>&#961;</mi><mi>A</mi></msub></mrow></mfrac><mfenced separators=""><msub><mi>&#961;</mi><mi>A</mi></msub><mo>+</mo><msub><mi>&#961;</mi><mi>b</mi></msub></mfenced>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
provided that <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced><msub><mi>&#961;</mi><mi>A</mi></msub><mo>&lt;</mo><mn>1</mn></math>.  Often  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced><msub><mi>&#961;</mi><mi>A</mi></msub><mo>&#8810;</mo><mn>1</mn></math>&#160;and then the bound effectively  simplifies to
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<msub><mi>&#961;</mi><mi>x</mi></msub><mo>&#8804;</mo><mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced><mfenced separators=""><msub><mi>&#961;</mi><mi>A</mi></msub><mo>+</mo><msub><mi>&#961;</mi><mi>b</mi></msub></mfenced><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
Hence, if we know <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>&#954;</mi><mfenced separators=""><mi>A</mi></mfenced></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>A</mi></msub></math>&#160;and
<math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>b</mi></msub></math>, we can compute a bound on the relative errors in  the solution.  Note that <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>A</mi></msub></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>b</mi></msub></math>&#160; and <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>x</mi></msub></math>&#160;are defined in terms of the norms of  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>.  If <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>,  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;or <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;contains elements of widely differing  magnitude, then <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>A</mi></msub></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>b</mi></msub></math>&#160;and  <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>x</mi></msub></math>&#160;will be dominated by the errors in the larger  elements, and <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#961;</mi><mi>x</mi></msub></math>&#160;will give no information about the  relative accuracy of smaller elements of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>.</div>
<div class="paramtext">

Another
way to obtain useful information about the accuracy of a solution  is to solve two sets of equations, one with the given coefficients, which  are assumed to be known with certainty to <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>&#160;figures, and one  with the coefficients rounded to (<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi><mo>-</mo><mn>1</mn></math>) figures, and to count  the number of figures to which the two solutions agree.  In ill-conditioned  problems this can be surprisingly small and even zero.</div>
<div class="paramtext">Chapter <a class="secref" href="../F07/f07_conts.xml">f07</a> contains functions for estimating condition numbers and for returning error bounds.</div>




<h3><a name="background2" id="background2"/>2.2&#160;&#160;The Least-squares Solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>&#8771;</mo><mi>b</mi></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>&gt;</mo><mi>n</mi></math>, <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>rank</mi><mo>&#8289;</mo><mi>A</mi></mrow><mo>=</mo><mi>n</mi></math></h3>

<div class="paramtext">The least-squares solution is the vector <math xmlns="http://www.w3.org/1998/Math/MathML"><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover></math>&#160;which  minimizes the sum of the squares of the residuals,
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>S</mi><mo>=</mo><msup><mfenced separators=""><mi>b</mi><mo>-</mo><mi>A</mi><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover></mfenced><mi mathvariant="italic">T</mi></msup><mfenced separators=""><mi>b</mi><mo>-</mo><mi>A</mi><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover></mfenced><mo>=</mo><msup><msub><mfenced open="&#8214;" close="&#8214;" separators=""><mi>b</mi><mo>-</mo><mi>A</mi><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover></mfenced><mn>2</mn></msub><mn>2</mn></msup><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
The solution is obtained in two steps.
</div><ol class="listroman"><li class="listroman">Householder Transformations are used to reduce <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;to &#8216;simpler form&#8217; via the equation <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi><mi>A</mi><mo>=</mo><mi>R</mi></math>, where  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>R</mi></math>&#160;has the appearance

<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mfenced separators=""><mfrac><mrow><mover><mrow><mi>R</mi></mrow><mo>^</mo></mover></mrow><mn>0</mn></mfrac></mfenced>
</math></td><td class="formula2"/></tr></table></div>

with <math xmlns="http://www.w3.org/1998/Math/MathML"><mover><mrow><mi>R</mi></mrow><mo>^</mo></mover></math>&#160;a non-singular upper triangular  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;matrix and 0 a zero matrix of shape  <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced separators=""><mi>m</mi><mo>-</mo><mi>n</mi></mfenced></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>.  Similar operations convert <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math>&#160;to  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi><mi>b</mi><mo>=</mo><mi>c</mi></math>, where

<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>c</mi><mo>=</mo><mfenced separators=""><mfrac><msub><mi>c</mi><mn>1</mn></msub><msub><mi>c</mi><mn>2</mn></msub></mfrac></mfenced>
</math></td><td class="formula2"/></tr></table></div>

with <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>c</mi><mn>1</mn></msub></math>&#160;having <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;rows and <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>c</mi><mn>2</mn></msub></math>&#160; having (<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>-</mo><mi>n</mi></math>) rows.</li><li class="listroman">The required least-squares solution is obtained by back-substitution  in the equation

<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mover><mrow><mi>R</mi></mrow><mo>^</mo></mover><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover><mo>=</mo><msub><mi>c</mi><mn>1</mn></msub><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
</li></ol><div class="paramtext">
Again due to rounding errors the computed <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover><mn>0</mn></msub></math>&#160;is  only an approximation to the required <math xmlns="http://www.w3.org/1998/Math/MathML"><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover></math>&#160;.
</div>




<h3><a name="background3" id="background3"/>2.3&#160;&#160;Rank-deficient Cases</h3>

<div class="paramtext">If, in the least-squares problem just discussed,  <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>rank</mi><mo>&#8289;</mo><mfenced separators=""><mi>A</mi></mfenced></mrow><mo>&lt;</mo><mi>n</mi></math>, then a least-squares solution exists  but it is not unique.  In this situation it is usual to ask for the  least-squares solution &#8216;of minimal length&#8217;, i.e., the vector  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;which minimizes <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mfenced open="&#8214;" close="&#8214;" separators=""><mi>x</mi></mfenced><mn>2</mn></msub></math>,  among all those <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;for which <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mfenced open="&#8214;" close="&#8214;" separators=""><mi>b</mi><mo>-</mo><mi>A</mi><mi>x</mi></mfenced><mn>2</mn></msub></math>&#160; is a minimum.</div>
<div class="paramtext">This can be computed from the Singular Value Decomposition (SVD) of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>, in which <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is factorized as
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>A</mi><mo>=</mo><mi>Q</mi><mi>D</mi><msup><mi>P</mi><mi mathvariant="italic">T</mi></msup>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi></math>&#160;is an <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;matrix with orthonormal columns, <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi></math>&#160;is an <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;orthogonal matrix and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;is an <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;diagonal matrix.  The diagonal elements of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;are called the &#8216;singular values&#8217; of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>; they are non-negative and can be arranged in decreasing order of magnitude:
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<msub><mi>d</mi><mn>1</mn></msub><mo>&#8805;</mo><msub><mi>d</mi><mn>2</mn></msub><mo>&#8805;</mo><mo>&#8943;</mo><mo>&#8805;</mo><msub><mi>d</mi><mi>n</mi></msub><mo>&#8805;</mo><mn>0</mn><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
The columns of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi></math>&#160;are called respectively  the left and right singular vectors of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>.  If the singular  values <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>d</mi><mrow><mi>r</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>,</mo><mo>&#8230;</mo><mo>,</mo><msub><mi>d</mi><mi>n</mi></msub></math>&#160;are zero or negligible, but  <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>d</mi><mi>r</mi></msub></math>&#160;is not negligible, then the rank of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is  taken to be <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi></math>&#160;(see also Section <a class="secref" href="#background4">2.4</a>)  and the minimal length least-squares solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>&#8771;</mo><mi>b</mi></math>&#160; is given by
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mover><mrow><mi>x</mi></mrow><mo>^</mo></mover><mo>=</mo><msup><mi>D</mi><mo>&#8224;</mo></msup><msup><mi>Q</mi><mi mathvariant="italic">T</mi></msup><mi>b</mi>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
where <math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mi>D</mi><mo>&#8224;</mo></msup></math>&#160;is the diagonal matrix with diagonal elements <math xmlns="http://www.w3.org/1998/Math/MathML"><msubsup><mi>d</mi><mn>1</mn><mrow><mo>-</mo><mn>1</mn></mrow></msubsup><mo>,</mo><msubsup><mi>d</mi><mn>2</mn><mrow><mo>-</mo><mn>1</mn></mrow></msubsup><mo>,</mo><mo>&#8230;</mo><mo>,</mo><msubsup><mi>d</mi><mi>r</mi><mrow><mo>-</mo><mn>1</mn></mrow></msubsup><mo>,</mo><mn>0</mn><mo>,</mo><mo>&#8230;</mo><mo>,</mo><mn>0</mn></math>.</div>
<div class="paramtext">The SVD  may also be used to find solutions to the homogeneous system of equations  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>=</mo><mn>0</mn></math>, where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;by  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>.  Such solutions exist if and only if  <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi>rank</mi><mo>&#8289;</mo><mfenced separators=""><mi>A</mi></mfenced></mrow><mo>&lt;</mo><mi>n</mi></math>, and are given by
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>x</mi><mo>=</mo><munderover><mo>&#8721;</mo><mrow><mi>i</mi><mo>=</mo><mi>r</mi><mo>+</mo><mn>1</mn></mrow><mi>n</mi></munderover><msub><mi>&#945;</mi><mi>i</mi></msub><msub><mi>p</mi><mi>i</mi></msub>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
where the <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>&#945;</mi><mi>i</mi></msub></math>&#160;are arbitrary numbers and the  <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>p</mi><mi>i</mi></msub></math>&#160;are the columns of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi></math>&#160;which correspond  to negligible elements of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>.</div>
<div class="paramtext">The general solution to the rank-deficient least-squares problem is given  by <math xmlns="http://www.w3.org/1998/Math/MathML"><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover><mo>+</mo><mi>x</mi></math>, where <math xmlns="http://www.w3.org/1998/Math/MathML"><mover><mrow><mi>x</mi></mrow><mo>^</mo></mover></math>&#160;is the minimal  length least-squares solution and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>&#160;is any solution of the  homogeneous system of equations <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>=</mo><mn>0</mn></math>.</div>




<h3><a name="background4" id="background4"/>2.4&#160;&#160;The Rank of a Matrix</h3>

<div class="paramtext">In theory the rank is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi></math>&#160;if <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>-</mo><mi>r</mi></math>&#160;elements of  the diagonal matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>D</mi></math>&#160;of the singular value decomposition  are exactly zero.  In practice, due to rounding and/or experimental errors,  some of these elements have very small values which usually can and should  be treated as zero.</div>
<div class="paramtext">For example, the following 5 by 8 matrix has rank 3 in exact arithmetic:
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mfenced separators="">
 <mtable columnalign="right">
  <mtr>
   <mtd><mn>22</mn></mtd>
   <mtd><mn>14</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>1</mn></mrow></mtd>
   <mtd><mrow><mo>-</mo><mn>3</mn></mrow></mtd>
   <mtd><mn>9</mn></mtd>
   <mtd><mn>9</mn></mtd>
   <mtd><mn>2</mn></mtd>
   <mtd><mn>4</mn></mtd>
  </mtr><mtr>
   <mtd><mn>10</mn></mtd>
   <mtd><mn>7</mn></mtd>
   <mtd><mn>13</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>2</mn></mrow></mtd>
   <mtd><mn>8</mn></mtd>
   <mtd><mn>1</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>6</mn></mrow></mtd>
   <mtd><mn>5</mn></mtd>
  </mtr><mtr>
   <mtd><mn>2</mn></mtd>
   <mtd><mn>10</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>1</mn></mrow></mtd>
   <mtd><mn>13</mn></mtd>
   <mtd><mn>1</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>7</mn></mrow></mtd>
   <mtd><mn>6</mn></mtd>
   <mtd><mn>0</mn></mtd>
  </mtr><mtr>
   <mtd><mn>3</mn></mtd>
   <mtd><mn>0</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>11</mn></mrow></mtd>
   <mtd><mrow><mo>-</mo><mn>2</mn></mrow></mtd>
   <mtd><mrow><mo>-</mo><mn>2</mn></mrow></mtd>
   <mtd><mn>5</mn></mtd>
   <mtd><mn>5</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>2</mn></mrow></mtd>
  </mtr><mtr>
   <mtd><mn>7</mn></mtd>
   <mtd><mn>8</mn></mtd>
   <mtd><mn>3</mn></mtd>
   <mtd><mn>4</mn></mtd>
   <mtd><mn>4</mn></mtd>
   <mtd><mrow><mo>-</mo><mn>1</mn></mrow></mtd>
   <mtd><mn>1</mn></mtd>
   <mtd><mn>2</mn></mtd>
  </mtr>
 </mtable>
</mfenced>
<mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">

On a computer with 7 decimal digits of precision the computed singular values were
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mn>3.5</mn><mo>&#215;</mo><msup><mn>10</mn><mn>1</mn></msup><mtext>,&#160;&#8195;</mtext> <mn>2.0</mn><mo>&#215;</mo><msup><mn>10</mn><mn>1</mn></msup><mtext>,&#160;&#8195;</mtext> <mn>2.0</mn><mo>&#215;</mo><msup><mn>10</mn><mn>1</mn></msup><mtext>,&#160;&#8195;</mtext> <mn>1.3</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>6</mn></mrow></msup><mtext>,&#160;&#8195;</mtext> <mn>5.5</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>7</mn></mrow></msup>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
and the rank would be correctly taken to be 3.</div>
<div class="paramtext">It is not, however, always certain that small computed singular values are really zero.  With the 7 by 7 Hilbert matrix, for example, where <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>a</mi><mrow><mi>i</mi><mi>j</mi></mrow></msub><mo>=</mo><mn>1</mn><mo>/</mo><mfenced separators=""><mi>i</mi><mo>+</mo><mi>j</mi><mo>-</mo><mn>1</mn></mfenced></math>, the singular values are
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mn>1.7</mn><mtext>,&#160;&#8195;</mtext><mn>2.7</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>1</mn></mrow></msup><mtext>,&#160;&#8195;</mtext><mn>2.1</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>2</mn></mrow></msup><mtext>,&#160;&#8195;</mtext><mn>1.0</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>3</mn></mrow></msup><mtext>,&#160;&#8195;</mtext><mn>2.9</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>5</mn></mrow></msup><mtext>,&#160;&#8195;</mtext><mn>4.9</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>7</mn></mrow></msup><mtext>,&#160;&#8195;</mtext><mn>3.5</mn><mo>&#215;</mo><msup><mn>10</mn><mrow><mo>-</mo><mn>9</mn></mrow></msup><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
Here there is no clear cut-off between small (i.e., negligible) singular  values and larger ones.  In fact, in exact arithmetic, the matrix is known  to have full rank and none of its singular values is zero.  On a computer  with 7 decimal digits of precision, the matrix is effectively singular,  but should its rank be taken to be 6, or 5, or 4?</div>
<div class="paramtext">It is therefore impossible to give an infallible rule, but generally the rank can be taken to be the number of singular values which are neither zero nor very small compared with other singular values.  For example, if there is a sharp decrease in singular values from numbers  of order unity to numbers of order <math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mn>10</mn><mrow><mo>-</mo><mn>7</mn></mrow></msup></math>, then the latter will almost certainly be zero in a machine in which 7 significant decimal figures is the maximum accuracy.  Similarly for a least-squares problem in which the data is known to about four significant figures and the largest singular value is of order unity then a singular value  of order <math xmlns="http://www.w3.org/1998/Math/MathML"><msup><mn>10</mn><mrow><mo>-</mo><mn>4</mn></mrow></msup></math>&#160;or less should almost certainly be regarded as zero.</div>
<div class="paramtext">It should be emphasised that rank determination and least-squares solutions can be sensitive to the scaling of the matrix.  If at all possible the units of measurement should be chosen so that the elements of the matrix have data errors of approximately equal magnitude.</div>




<h3><a name="background5" id="background5"/>2.5&#160;&#160;Generalized Linear Least-squares Problems</h3>

<div class="paramtext">The simple type of linear least-squares problem described in  Section <a class="secref" href="#background2">2.2</a> can be generalized in various ways.
</div><ol class="listnumber"><li class="listnumber">Linear least-squares problems with <b>equality constraints</b>:

<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mtext>find&#160;</mtext><mi>x</mi><mtext>&#160;to&#160;minimize&#160;</mtext><mi>S</mi><mo>=</mo><msup><msub><mfenced open="&#8214;" close="&#8214;" separators=""><mi>c</mi><mo>-</mo><mi>A</mi><mi>x</mi></mfenced><mn>2</mn></msub><mn>2</mn></msup><mtext>&#8195;&#160;subject&#160;to&#160;&#8195;</mtext><mi>B</mi><mi>x</mi><mo>=</mo><mi>d</mi><mtext>,</mtext>
</math></td><td class="formula2"/></tr></table></div>

where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi></math>&#160;is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>, with <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi><mo>&#8804;</mo><mi>n</mi><mo>&#8804;</mo><mi>m</mi><mo>+</mo><mi>p</mi></math>.  The equations <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi><mi>x</mi><mo>=</mo><mi>d</mi></math>&#160;may be regarded as a set of equality constraints on the problem of minimizing <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>S</mi></math>.  Alternatively the problem may be regarded as solving an overdetermined system of equations

<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mfenced separators="">
 <mtable>
  <mtr>
   <mtd><mi>A</mi></mtd>
  </mtr><mtr>
   <mtd><mi>B</mi></mtd>
  </mtr>
 </mtable>
</mfenced>
<mi>x</mi><mo>=</mo><mfenced separators="">
 <mtable>
  <mtr>
   <mtd><mi>c</mi></mtd>
  </mtr><mtr>
   <mtd><mi>d</mi></mtd>
  </mtr>
 </mtable>
</mfenced>
<mtext>,</mtext>
</math></td><td class="formula2"/></tr></table></div>

where some of the equations (those involving <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi></math>) are to be solved exactly, and the others (those involving <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>) are to be solved in a least-squares sense.  The problem has a unique solution on the assumptions that <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi></math>&#160;has full row rank <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>&#160;and the matrix <math xmlns="http://www.w3.org/1998/Math/MathML">
<mfenced separators="">
 <mtable>
  <mtr>
   <mtd><mi>A</mi></mtd>
  </mtr><mtr>
   <mtd><mi>B</mi></mtd>
  </mtr>
 </mtable>
</mfenced>
</math>&#160; has full column rank <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>.  (For linear least-squares problems with <b>inequality constraints</b>,  refer to Chapter <a class="secref" href="../E04/e04_conts.xml">e04</a>.)</li><li class="listnumber"><b>General Gauss&#8211;Markov linear model problems</b>:

<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mtext>minimize&#160;</mtext><msub><mfenced open="&#8214;" close="&#8214;" separators=""><mi>y</mi></mfenced><mn>2</mn></msub><mtext>&#8195;&#160;subject&#160;to&#160;&#8195;</mtext><mi>d</mi><mo>=</mo><mi>A</mi><mi>x</mi><mo>+</mo><mi>B</mi><mi>y</mi><mtext>,</mtext>
</math></td><td class="formula2"/></tr></table></div>

where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;and <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi></math>&#160;is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>p</mi></math>, with <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo>&#8804;</mo><mi>m</mi><mo>&#8804;</mo><mi>n</mi><mo>+</mo><mi>p</mi></math>.  When <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi><mo>=</mo><mi>I</mi></math>, the problem reduces to an ordinary linear least-squares problem.  When <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi></math>&#160;is square and nonsingular, it is equivalent to a  <b>weighted linear least-squares problem</b>:

<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mtext>find&#160;</mtext><mi>x</mi><mtext>&#160;to&#160;minimize&#160;</mtext><msub><mfenced open="&#8214;" close="&#8214;" separators=""><msup><mi>B</mi><mrow><mo>-</mo><mn>1</mn></mrow></msup><mfenced separators=""><mi>d</mi><mo>-</mo><mi>A</mi><mi>x</mi></mfenced></mfenced><mn>2</mn></msub><mtext>.</mtext>
</math></td><td class="formula2"/></tr></table></div>

The problem has a unique solution on the assumptions that <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;has full column rank <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>, and the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mfenced separators=""><mrow><mi>A</mi></mrow><mo>,</mo><mrow><mi>B</mi></mrow></mfenced></math>&#160;has full row rank <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi></math>.</li></ol><div class="paramtext">
</div>




<h3><a name="background6" id="background6"/>2.6&#160;&#160;Calculating the Inverse of a Matrix</h3>

<div class="paramtext">The functions in this chapter can also be used to calculate the inverse of a square matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;by solving the equation
</div>
<div class="formula"><table class="formula"><tr><td class="formula"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mi>A</mi><mi>X</mi><mo>=</mo><mi>I</mi>
</math></td><td class="formula2"/></tr></table></div>
<div class="paramtext">
where <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>I</mi></math>&#160;is the identity matrix.  However, solving the equations  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>X</mi><mo>=</mo><mi>B</mi></math>&#160;by calculation of the inverse of the coefficient matrix  <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>, i.e., by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>X</mi><mo>=</mo><msup><mi>A</mi><mrow><mo>-</mo><mn>1</mn></mrow></msup><mi>B</mi></math>, is <b>definitely  not recommended</b>.</div>
<div class="paramtext">Similar remarks apply to the calculation of the pseudo inverse of a singular or rectangular matrix.</div>






<h2><a name="available" id="available"/>3&#160;&#160;Recommendations on Choice and Use of Available Functions</h2>





<h3><a name="recomm_1" id="recomm_1"/>3.1&#160;&#160;Black Box and General Purpose Functions</h3>

<div class="paramtext">Most of the functions in this chapter are categorised as Black Box functions  or general purpose functions.</div>
<div class="paramtext">Black Box functions solve the equations <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><msub><mi>x</mi><mi>i</mi></msub><mo>=</mo><msub><mi>b</mi><mi>i</mi></msub></math>,  for <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>i</mi><mo>=</mo><mn>1</mn><mo>,</mo><mn>2</mn><mo>,</mo><mo>&#8230;</mo><mo>,</mo><mi>p</mi></math>, in a single call with the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160; and the right-hand sides <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>b</mi><mi>i</mi></msub></math>&#160;being supplied as data.  These are  the simplest functions to use and are suitable when all the right-hand sides are  known in advance and do not occupy too much storage.</div>
<div class="paramtext">General purpose functions, in general, require a previous call to a function in  Chapters <a class="secref" href="../F01/f01_conts.xml">f01</a> or <a class="secref" href="../F03/f03_conts.xml">f03</a> to factorize the matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>.  This factorization  can then be used repeatedly to solve the equations for one or more right-hand  sides which may be generated in the course of the computation.  The Black Box  functions simply call a factorization function and then a general purpose function  to solve the equations.</div>





<h3><a name="recomm_2" id="recomm_2"/>3.2&#160;&#160;Systems of Linear Equations</h3>

<div class="paramtext">Most of the functions in this chapter solve linear equations <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi><mi>x</mi><mo>=</mo><mi>b</mi></math>&#160;when <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;by <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi></math>&#160;and a unique  solution is expected (case <math xmlns="http://www.w3.org/1998/Math/MathML"><mn>2.1</mn></math>).  If this turns out to be untrue the functions  go to a failure exit.  The matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;may be &#8216;general&#8217; real  or complex, or may have special structure or properties, e.g., it may be  banded, tridiagonal, almost block-diagonal, sparse, symmetric, Hermitian,  positive-definite (or various combinations of these).
For some of the combinations see Chapter <a class="secref" href="../F07/f07_conts.xml">f07</a>.  <a class="rtnref" href="../F04/f04mcc.xml">nag_real_cholesky_skyline_solve (f04mcc)</a> (which needs to be preceded by a call to <a class="rtnref" href="../F01/f01mcc.xml">nag_real_cholesky_skyline (f01mcc)</a>) can be used for the solution of variable band-width (skyline) positive-definite systems.
</div>
<div class="paramtext">It must be emphasised that it is a waste of computer time and space to use an inappropriate function, for example one for the complex case when the equations are real.  It is also unsatisfactory to use the special functions for a positive-definite matrix if this property is not known in advance.</div>


<div class="paramtext">Other functions for solving linear equation systems, computing inverse  matrices, and estimating condition numbers can be found  in Chapter <a class="secref" href="../F07/f07_conts.xml">f07</a>,  which contains LAPACK software.</div>




<h3><a name="recomm_3" id="recomm_3"/>3.3&#160;&#160;Linear Least-squares Problems</h3>





<div class="paramtext">Functions for solving linear least-squares problems using the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi><mi>R</mi></math>&#160;factorization or the SVD can be found in<br/>
Chapters <a class="secref" href="../F01/f01_conts.xml">f01</a>, <a class="secref" href="../F02/f02_conts.xml">f02</a> and <a class="secref" href="../F08/f08_conts.xml">f08</a>.  When <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>&#8805;</mo><mi>n</mi></math>&#160;and a unique solution is expected, the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi><mi>R</mi></math>&#160;factorization can be used, otherwise the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi><mi>R</mi></math>&#160;factorization with pivoting, or the SVD should be used.  For <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>m</mi><mo>&#8811;</mo><mi>n</mi></math>, the SVD is not significantly more expensive than the <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>Q</mi><mi>R</mi></math>&#160;factorization.  See Chapter <a class="secref" href="../F08/f08_conts.xml">f08</a> for further discussion.</div>
<div class="paramtext">Problems with linear <b>equality constraints</b> can be solved by

functions in Chapter <a class="secref" href="../F08/f08_conts.xml">f08</a>
provided that the problems are of full rank.  Problems  with linear <b>inequality constraints</b> can be solved by <a class="rtnref" href="../E04/e04ncc.xml">nag_opt_lin_lsq (e04ncc)</a> in Chapter <a class="secref" href="../E04/e04_conts.xml">e04</a>.</div>
<div class="paramtext">General Gauss&#8211;Markov linear model problems, as formulated in  Section <a class="secref" href="#background5">2.5</a>, can be solved by

functions in Chapter <a class="secref" href="../F08/f08_conts.xml">f08</a>.
</div>




<h3><a name="recomm_4" id="recomm_4"/>3.4&#160;&#160;Sparse Matrix Functions</h3>




<div class="paramtext">For the solution of sparse linear equations see Chapter <a class="secref" href="../F11/f11_conts.xml">f11</a>.</div>






<h2><a name="dtree" id="dtree"/>4&#160;&#160;Decision Trees</h2>

<div class="paramtext">If at any stage the answer to a question is &#8216;Don't know&#8217; this should  be read as &#8216;No&#8217;.</div>
<div class="paramtext">The name of the function (if any) that should be used to factorize the  matrix <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;is given in brackets after the name of the function  for solving the equations.</div>

<h4><a name="tree1" id="tree1"/>Tree 1: Black Box functions for unique solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi mathvariant="bold-italic">A</mi><mi mathvariant="bold-italic">x</mi><mo>=</mo><mi mathvariant="bold-italic">b</mi></math>&#160;</h4>
<table class="dtree">
<tr>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a real matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F04/f04arc.xml">f04arc</a></td></tr>
<tr>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr>
<td class="dtentry"><a class="rtnref" href="../F04/f04adc.xml">f04adc</a></td></tr></table>


<h4><a name="tree2" id="tree2"/>Tree 2: General purpose functions for unique solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi mathvariant="bold-italic">A</mi><mi mathvariant="bold-italic">x</mi><mo>=</mo><mi mathvariant="bold-italic">b</mi></math>&#160;</h4>
<table class="dtree">
<tr>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a real matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a symmetric positive-definite matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a variable band matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F04/f04mcc.xml">f04mcc</a> (<a class="rtnref" href="../F01/f01mcc.xml">f01mcc</a>)</td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/><td class="dtnobar">|</td>
<td/>
<td class="dtentry"><a class="rtnref" href="../F04/f04agc.xml">f04agc</a> (<a class="rtnref" href="../F03/f03aec.xml">f03aec</a>)</td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/>
<td class="dtentry"><a class="rtnref" href="../F04/f04ajc.xml">f04ajc</a> (<a class="rtnref" href="../F03/f03afc.xml">f03afc</a>)</td></tr>
<tr>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a Hermitian positive-definite matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F04/f04awc.xml">f04awc</a> (<a class="rtnref" href="../F01/f01bnc.xml">f01bnc</a>)</td></tr>
<tr>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr>
<td class="dtentry"><a class="rtnref" href="../F04/f04akc.xml">f04akc</a> (<a class="rtnref" href="../F03/f03ahc.xml">f03ahc</a>)</td></tr></table>



<h4><a name="complexmatrix" id="complexmatrix"/>Tree 3: General purpose functions for unique solution of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi mathvariant="bold-italic">A</mi><mi mathvariant="bold-italic">x</mi><mo>=</mo><mi mathvariant="bold-italic">b</mi></math>&#160;(Complex matrix)
</h4>
<table class="dtree">
<tr>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;Hermitian?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;positive-definite?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a band matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F07/f07hsc.xml">f07hsc</a> (<a class="rtnref" href="../F07/f07hrc.xml">f07hrc</a>)</td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/><td class="dtnobar">|</td>
<td/>
<td class="dtentry">Is one triangle of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;stored as a linear array?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F07/f07gsc.xml">f07gsc</a> (<a class="rtnref" href="../F07/f07grc.xml">f07grc</a>)</td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/><td class="dtnobar">|</td>
<td/>
<td class="dtentry"><a class="rtnref" href="../F07/f07fsc.xml">f07fsc</a> (<a class="rtnref" href="../F07/f07frc.xml">f07frc</a>)</td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/>
<td class="dtentry">Is one triangle of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;stored as a linear array?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F07/f07psc.xml">f07psc</a> (<a class="rtnref" href="../F07/f07prc.xml">f07prc</a>)</td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/>
<td class="dtentry"><a class="rtnref" href="../F07/f07msc.xml">f07msc</a> (<a class="rtnref" href="../F07/f07mrc.xml">f07mrc</a>)</td></tr>
<tr>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;symmetric?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry">Is one triangle of <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;stored as a linear array?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F07/f07qsc.xml">f07qsc</a> (<a class="rtnref" href="../F07/f07qrc.xml">f07qrc</a>)</td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/>
<td class="dtentry"><a class="rtnref" href="../F07/f07nsc.xml">f07nsc</a>) (<a class="rtnref" href="../F07/f07nrc.xml">f07nrc</a>)</td></tr>
<tr>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;triangular?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a band matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F07/f07vsc.xml">f07vsc</a></td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;stored as a linear array?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F07/f07usc.xml">f07usc</a></td></tr>
<tr>
<td class="dtnobar">|</td>
<td/>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr><td class="dtnobar">|</td>
<td/>
<td class="dtentry"><a class="rtnref" href="../F07/f07tsc.xml">f07tsc</a></td></tr>
<tr>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr>
<td class="dtentry">Is <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>A</mi></math>&#160;a band matrix?</td>
<td class="dtnobar">_<br/>yes</td>
<td class="dtentry"><a class="rtnref" href="../F07/f07bsc.xml">f07bsc</a> (<a class="rtnref" href="../F07/f07brc.xml">f07brc</a>)</td></tr>
<tr>
<td class="dtnobar">no<br/>|</td>
<td/></tr>
<tr>
<td class="dtentry"><a class="rtnref" href="../F07/f07asc.xml">f07asc</a> (<a class="rtnref" href="../F07/f07arc.xml">f07arc</a>)</td></tr></table>








<h2><a name="index" id="index"/>5&#160;&#160;Index</h2>

<table>
   <tr><td class="index1">Black Box functions, <math xmlns="http://www.w3.org/1998/Math/MathML">
         <mi>A</mi>
         <mi>x</mi>
         <mo>=</mo>
         <mi>b</mi>
      </math>,</td><td class="index2"/></tr>
   
      <tr><td class="index1">&#160;&#160;&#160;&#160;Complex matrix</td><td class="index2"><a class="rtnref" href="../F04/f04adc.xml">f04adc</a></td></tr>
      <tr><td class="index1">&#160;&#160;&#160;&#160;Real matrix,</td><td class="index2"/></tr>
      
         <tr><td class="index1">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Single right-hand side</td><td class="index2"><a class="rtnref" href="../F04/f04arc.xml">f04arc</a></td></tr>
      
   
   <tr><td class="index1">General Purpose functions, <math xmlns="http://www.w3.org/1998/Math/MathML">
         <mi>A</mi>
         <mi>x</mi>
         <mo>=</mo>
         <mi>b</mi>
      </math>,</td><td class="index2"/></tr>
   
      <tr><td class="index1">&#160;&#160;&#160;&#160;Complex Hermitian positive-definite matrix</td><td class="index2"><a class="rtnref" href="../F04/f04awc.xml">f04awc</a></td></tr>
      <tr><td class="index1">&#160;&#160;&#160;&#160;Complex matrix</td><td class="index2"><a class="rtnref" href="../F04/f04akc.xml">f04akc</a></td></tr>
      <tr><td class="index1">&#160;&#160;&#160;&#160;Real band symmetric positive-definite matrix,</td><td class="index2"/></tr>
      
         <tr><td class="index1">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;variable bandwidth</td><td class="index2"><a class="rtnref" href="../F04/f04mcc.xml">f04mcc</a></td></tr>
      
      <tr><td class="index1">&#160;&#160;&#160;&#160;Real matrix</td><td class="index2"><a class="rtnref" href="../F04/f04ajc.xml">f04ajc</a></td></tr>
      <tr><td class="index1">&#160;&#160;&#160;&#160;Real symmetric positive-definite matrix</td><td class="index2"><a class="rtnref" href="../F04/f04agc.xml">f04agc</a></td></tr>
   
</table>





<h2><a name="withdrawn" id="withdrawn"/>6&#160;&#160;Functions Withdrawn or Scheduled for Withdrawal</h2>
  <p>None.</p>





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

<div class="paramtext">
<p><a name="ref105" id="ref105"/>Golub G H and Van Loan C F (1996) <i>Matrix Computations</i> (3rd Edition) Johns Hopkins University Press, Baltimore </p>
<p><a name="ref116" id="ref116"/>Lawson C L and Hanson R J (1974) <i>Solving Least-squares Problems</i> Prentice&#8211;Hall </p>
<p><a name="ref103" id="ref103"/>Wilkinson J H and Reinsch C (1971) <i>Handbook for Automatic Computation II, Linear Algebra</i> Springer&#8211;Verlag </p>
</div>

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