Next: , Previous: luinc, Up: Function Reference


22.6.0.12 matrix_type

— Loadable Function: type = matrix_type (a)
— Loadable Function: a = matrix_type (a, type)
— Loadable Function: a = matrix_type (a, 'upper', perm)
— Loadable Function: a = matrix_type (a, 'lower', perm)
— Loadable Function: a = matrix_type (a, 'banded', nl, nu)

Identify the matrix type or mark a matrix as a particular type. This allows rapid for solutions of linear equations involving a to be performed. Called with a single argument, matrix_type returns the type of the matrix and caches it for future use. Called with more than one argument, matrix_type allows the type of the matrix to be defined.

The possible matrix types depend on whether the matrix is full or sparse, and can be one of the following

'unknown'
Remove any previously cached matrix type, and mark type as unknown
'full'
Mark the matrix as full.
'positive definite'
Full positive definite matrix.
'diagonal'
Diagonal Matrix. (Sparse matrices only)
'permuted diagonal'
Permuted Diagonal matrix. The permutation does not need to be specifically indicated, as the structure of the matrix explicitly gives this. (Sparse matrices only)
'upper'
Upper triangular. If the optional third argument perm is given, the matrix is assumed to be a permuted upper triangular with the permutations defined by the vector perm.
'lower'
Lower triangular. If the optional third argument perm is given, the matrix is assumed to be a permuted lower triangular with the permutations defined by the vector perm.
'banded'
'banded positive definite'
Banded matrix with the band size of nl below the diagonal and nu above it. If nl and nu are 1, then the matrix is tridiagonal and treated with specialized code. In addition the matrix can be marked as positive definite (Sparse matrices only)
'singular'
The matrix is assumed to be singular and will be treated with a minimum norm solution

Note that the matrix type will be discovered automatically on the first attempt to solve a linear equation involving a. Therefore matrix_type is only useful to give Octave hints of the matrix type. Incorrectly defining the matrix type will result in incorrect results from solutions of linear equations, and so it is entirely the responsibility of the user to correctly indentify the matrix type.