|
Calling Sequence
|
|
MatrixDecomposition(A, opts)
|
|
Parameters
|
|
A
|
-
|
Matrix; a square matrix
|
opts
|
-
|
(optional) equation(s) of the form keyword=value, where keyword is one of digits, method, output, showsteps; the options for factoring the matrix A
|
|
|
|
|
Options
|
|
|
The number of digits of precision in which the computations will be performed. By default, digits will be set to the environment variable Digits.
|
•
|
method = LU, PLU, LU[tridiagonal], PLU[scaled], LDU, LDLt, Cholesky
|
|
The type of decomposition to perform.
|
–
|
method = LU produces a factorization , where and are lower and upper triangular, respectively. It is also possible to obtain the Gaussian transformation matrices generated by this decomposition.
|
–
|
method = PLU produces a factorization , where and are lower and upper triangular, respectively, and is the permutation matrix. It is also possible to obtain Gaussian transformation and permutation matrices generated by this decomposition.
|
–
|
method = LU[tridiagonal] produces the factorization using the Crout factorization algorithm for tridiagonal matrices, where and are lower and upper triangular, respectively. Note that the matrix A must be tridiagonal; an error will be raised otherwise.
|
–
|
method = PLU[scaled] produces a factorization , where and are lower and upper triangular, respectively, and is the permutation matrix. This method uses scaled partial pivoting. It is also possible to obtain the Gaussian transformation and permutation matrices generated by this decomposition.
|
–
|
method = LDU produces the factorization , where is a unit lower-triangular matrix, is a diagonal matrix, and is the a unit upper-triangular matrix.
|
–
|
method = LDLt produces, for a symmetric real matrix A (Hermitian complex matrix A) the factorization , where is a unit lower-triangular matrix, is a diagonal matrix, and is the transpose (Hermitian, respectively) of . Note that A must be symmetric (Hermitian, respectively); an error will be raised otherwise.
|
–
|
method = Cholesky produces, for a positive definite matrix A, the factorization , where is lower triangular and is the transpose . Note that A must be positive definite; an error will be raised otherwise.
|
|
By default, method = PLU. See the output option below for a description of the possible return value(s) for each method.
|
|
The return value for the function. L represents the lower-triangular matrix, U represents the upper-triangular matrix and D represents the diagonal matrix.
|
–
|
If method = LU then output can be one or more of L, U, Mmatrices, where output = Mmatrices returns a list of Gaussian transformation matrices. By default, output = [L, U].
|
–
|
If method = PLU then output can be one or more of P, L, U, Mmatrices, Ematrices, where output = Mmatrices returns a list of Gaussian transformation matrices and output = Ematrices returns a list of permutation matrices. By default, output = [P, L, U].
|
–
|
If method = LU[tridiagonal] then output can be one or more of L, U. By default, output = [L, U].
|
–
|
If method = PLU[scaled] then output can be one or more of P, L, U, Mmatrices, Ematrices, where output = Mmatrices returns a list of Gaussian transformation matrices and output = Ematrices returns a list of permutation matrices. By default, output = [P, L, U].
|
–
|
If method = LDU then output can be one or more of L, D, U. By default, output = [L, D, U].
|
–
|
If method = LDLt then output can be one or more of L, D, Lt, where output = Lt returns the unit upper-triangular matrix. By default, output = [L, D, Lt].
|
–
|
If method = Cholesky then output can be one or more of R, Rt, where output = R returns the lower-triangular matrix and output = Rt returns the transpose of the lower-triangular matrix. By default, output = [R, Rt].
|
•
|
showsteps = true or false
|
|
Whether to print helpful statements into the interface as the command executes. This option is only available when output = LU, PLU or PLU[scaled]. By default, showsteps = false.
|
|
|
Description
|
|
•
|
Matrix decomposition is used to reduce the general linear system A.x=b to more manageable triangular systems.
|
•
|
The MatrixDecomposition command can perform the following decompositions: LU, PLU, LU Tridiagonal, PLU Scaled, LDU, LDLt and Cholesky.
|
|
|
Notes
|
|
•
|
Matrix decomposition is also sometimes referred to as matrix factorization. The terms are interchangeable.
|
•
|
When the method is set to either LU or LDU, this procedure operates symbolically; that is, the inputs are not automatically evaluated to floating-point quantities, and computations proceed symbolically and exactly whenever possible. To obtain floating-point results, it is necessary to supply floating-point inputs.
|
•
|
Otherwise, this procedure operates numerically; that is, if the inputs are not already numeric, they are first evaluated to floating-point quantities before computations proceed. The outputs will be numeric as well. Note that exact rationals are considered numeric and are preserved whenever possible throughout the computation; therefore, one must specify floating-point inputs instead of exact rationals to obtain floating-point outputs.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
Try an LU decomposition
>
|
|
| (2) |
>
|
|
| (3) |
Check that
| (4) |
>
|
|
| (5) |
Try a PLU decomposition
>
|
|
| (6) |
| (8) |
| (9) |
Perform a Cholesky decomposition
>
|
|
First check that A is positive definite
>
|
|
>
|
|
| (12) |
|
|
|