Functions

matrix_type.cc File Reference

#include <algorithm>
#include "ov.h"
#include "defun-dld.h"
#include "error.h"
#include "ov-re-mat.h"
#include "ov-cx-mat.h"
#include "ov-re-sparse.h"
#include "ov-cx-sparse.h"
#include "MatrixType.h"
#include "oct-locbuf.h"
Include dependency graph for matrix_type.cc:

Go to the source code of this file.

Functions

 DEFUN_DLD (matrix_type, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{type} =} matrix_type (@var{A})\n\ @deftypefnx {Loadable Function} {@var{type} =} matrix_type (@var{A}, 'nocompute')\n\ @deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, @var{type})\n\ @deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, 'upper', @var{perm})\n\ @deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, 'lower', @var{perm})\n\ @deftypefnx {Loadable Function} {@var{A} =} matrix_type (@var{A}, 'banded', @var{nl}, @var{nu})\n\ Identify the matrix type or mark a matrix as a particular type. This allows\n\ more rapid solutions of linear equations involving @var{A} to be performed.\n\ Called with a single argument, @code{matrix_type} returns the type of the\n\ matrix and caches it for future use. Called with more than one argument,\n\ @code{matrix_type} allows the type of the matrix to be defined.\n\ \n\ If the option 'nocompute' is given, the function will not attempt to guess\n\ the type if it is still unknown. This is useful for debugging purposes.\n\ \n\ The possible matrix types depend on whether the matrix is full or sparse, and\n\ can be one of the following\n\ \n\ @table @asis\n\ @item 'unknown'\n\ Remove any previously cached matrix type, and mark type as unknown.\n\ \n\ @item 'full'\n\ Mark the matrix as full.\n\ \n\ @item 'positive definite'\n\ Probable full positive definite matrix.\n\ \n\ @item 'diagonal'\n\ Diagonal matrix. (Sparse matrices only)\n\ \n\ @item 'permuted diagonal'\n\ Permuted Diagonal matrix. The permutation does not need to be specifically\n\ indicated, as the structure of the matrix explicitly gives this. (Sparse\n\ matrices only)\n\ \n\ @item 'upper'\n\ Upper triangular. If the optional third argument @var{perm} is given, the\n\ matrix is assumed to be a permuted upper triangular with the permutations\n\ defined by the vector @var{perm}.\n\ \n\ @item 'lower'\n\ Lower triangular. If the optional third argument @var{perm} is given, the\n\ matrix is assumed to be a permuted lower triangular with the permutations\n\ defined by the vector @var{perm}.\n\ \n\ @item 'banded'\n\ @itemx 'banded positive definite'\n\ Banded matrix with the band size of @var{nl} below the diagonal and @var{nu}\n\ above it. If @var{nl} and @var{nu} are 1, then the matrix is tridiagonal and\n\ treated with specialized code. In addition the matrix can be marked as\n\ probably a positive definite. (Sparse matrices only)\n\ \n\ @item 'singular'\n\ The matrix is assumed to be singular and will be treated with a minimum norm\n\ solution.\n\ \n\ @end table\n\ \n\ Note that the matrix type will be discovered automatically on the first\n\ attempt to solve a linear equation involving @var{A}. Therefore\n\ @code{matrix_type} is only useful to give Octave hints of the matrix type.\n\ Incorrectly defining the matrix type will result in incorrect results from\n\ solutions of linear equations; it is entirely @strong{the responsibility of\n\ the user} to correctly identify the matrix type.\n\ \n\ Also, the test for positive definiteness is a low-cost test for a Hermitian\n\ matrix with a real positive diagonal. This does not guarantee that the\n\ matrix is positive definite, but only that it is a probable candidate. When\n\ such a matrix is factorized, a Cholesky@tie{}factorization is first\n\ attempted, and if that fails the matrix is then treated with an\n\ LU@tie{}factorization. Once the matrix has been factorized,\n\ @code{matrix_type} will return the correct classification of the matrix.\n\ @end deftypefn")

Function Documentation

DEFUN_DLD ( matrix_type  ,
args   
)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines