Computing the inverse of a matrix using LU-decomposition
This functionality does not run in MATLAB.
linalg::inverseLU(A) linalg::inverseLU(L, U, pivindex)
linalg::inverseLU(A) computes the inverse of the square matrix A using LU-decomposition.
linalg::inverseLU(L, U, pivindex) computes the inverse of the matrix A = P- 1 L U where L, U and pivindex are the result of an LU-deomposition of the (nonsingular) Matrix A, as computed by linalg::factorLU.
The matrix A must be nonsingular.
pivindex is a list [r, r, ...] representing a permutation matrix P such that B = PA = LU, where bij = ari, j.
It is not checked whether pivindex has such a form.
The component ring of the input matrices must be a field, i.e., a domain of category Cat::Field.
We compute the inverse of the matrix:
A := Dom::Matrix(Dom::Real)( [[2, -3, -1], [1, 1, -1], [0, 1, -1]] )
Ai := linalg::inverseLU(A)
We check the result:
A * Ai, Ai * A
We can also compute the inverse of A in the usual way:
linalg::inverseLU should be used for efficiency reasons in the case where an LU decomposition of a matrix already is computed, as the next example illustrates.
If we already have an LU decomposition of a (nonsingular) matrix, we can compute the inverse of the matrix A = P- 1 L U as follows:
LU := linalg::factorLU(linalg::hilbert(3))
linalg::inverseLU then only needs to perform forward and backward substitution to compute the inverse matrix (see also linalg::matlinsolveLU).
A, L, U
A square matrix of a domain of category Cat::Matrix
A list of positive integers