- publishing free software manuals
GNU Octave Manual Version 3
by John W. Eaton, David Bateman, Søren Hauberg
Paperback (6"x9"), 568 pages
ISBN 095461206X
RRP £24.95 ($39.95)

Get a printed copy>>>

18.1 Techniques used for Linear Algebra

Octave uses a polymorphic solver which 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, and the type is cached once it is calculated, so that it is not re-determined each time the matrix is used.

The selection tree for solving a linear system or computing a matrix inverse is as follows:

  1. If the matrix is upper or lower triangular sparse, try a forward or backward substitution using the lapack xTRTRS function, and goto 4.
  2. If the matrix is square, hermitian with a real positive diagonal, attempt Cholesky factorization using the lapack xPOTRF function.
  3. If the Cholesky factorization failed or the matrix is not hermitian with a real positive diagonal, and the matrix is square, factorize using the lapack xGETRF function.
  4. 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 lapack xGELSD function.

The user can force the type of the matrix with the matrix_type 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 matrix_type should be used with care.

ISBN 095461206XGNU Octave Manual Version 3See the print edition