<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Techniques Used for Linear Algebra (GNU Octave (version 5.1.0))</title> <meta name="description" content="Techniques Used for Linear Algebra (GNU Octave (version 5.1.0))"> <meta name="keywords" content="Techniques Used for Linear Algebra (GNU Octave (version 5.1.0))"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <link href="index.html#Top" rel="start" title="Top"> <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Linear-Algebra.html#Linear-Algebra" rel="up" title="Linear Algebra"> <link href="Basic-Matrix-Functions.html#Basic-Matrix-Functions" rel="next" title="Basic Matrix Functions"> <link href="Linear-Algebra.html#Linear-Algebra" rel="prev" title="Linear Algebra"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> <link rel="stylesheet" type="text/css" href="octave.css"> </head> <body lang="en"> <a name="Techniques-Used-for-Linear-Algebra"></a> <div class="header"> <p> Next: <a href="Basic-Matrix-Functions.html#Basic-Matrix-Functions" accesskey="n" rel="next">Basic Matrix Functions</a>, Up: <a href="Linear-Algebra.html#Linear-Algebra" accesskey="u" rel="up">Linear Algebra</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> <hr> <a name="Techniques-Used-for-Linear-Algebra-1"></a> <h3 class="section">18.1 Techniques Used for Linear Algebra</h3> <a name="index-linear-algebra_002c-techniques"></a> <p>Octave includes a polymorphic solver that selects an appropriate matrix factorization depending on the properties of the matrix itself. Generally, the cost of determining the matrix type is small relative to the cost of factorizing the matrix itself. In any case the matrix type is cached once it is calculated so that it is not re-determined each time it is used in a linear equation. </p> <p>The selection tree for how the linear equation is solved or a matrix inverse is formed is given by: </p> <ol> <li> If the matrix is upper or lower triangular sparse use a forward or backward substitution using the <small>LAPACK</small> xTRTRS function, and goto 4. </li><li> If the matrix is square, Hermitian with a real positive diagonal, attempt Cholesky factorization using the <small>LAPACK</small> xPOTRF function. </li><li> If the Cholesky factorization failed or the matrix is not Hermitian with a real positive diagonal, and the matrix is square, factorize using the <small>LAPACK</small> xGETRF function. </li><li> If the matrix is not square, or any of the previous solvers flags a singular or near singular matrix, find a least squares solution using the <small>LAPACK</small> xGELSD function. </li></ol> <p>The user can force the type of the matrix with the <code>matrix_type</code> function. This overcomes the cost of discovering the type of the matrix. However, it should be noted that identifying the type of the matrix incorrectly will lead to unpredictable results, and so <code>matrix_type</code> should be used with care. </p> <p>It should be noted that the test for whether a matrix is a candidate for Cholesky factorization, performed above, and by the <code>matrix_type</code> function, does not make certain that the matrix is Hermitian. However, the attempt to factorize the matrix will quickly detect a non-Hermitian matrix. </p> <hr> <div class="header"> <p> Next: <a href="Basic-Matrix-Functions.html#Basic-Matrix-Functions" accesskey="n" rel="next">Basic Matrix Functions</a>, Up: <a href="Linear-Algebra.html#Linear-Algebra" accesskey="u" rel="up">Linear Algebra</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> </body> </html>