![]() |
LU decomposition has many applications, for example, the determinant calculation. If the square matrix A is represented as A = PLU, we can easily calculate the determinant of matrix A, since det L = 1, det P = +1 or det P = -1 (depending on the permutation), and the determinant of matrix U is equal to the product of its diagonal elements.
The subroutine RMatrixLUDet calculates the determinant of a matrix whose LU decomposition has already been performed. The output of LUDecomposition subroutine is used as the input: matrices L and U in compact form and the permutation matrix. The subroutine returns the determinant of the matrix. It is recommended to use this subroutine if you have already performed the LU decomposition and want to use it to calculate the matrix determinant.
The subroutine RMatrixDet calculates the determinant of a matrix whose LU-decomposition hasn't been performed yet. The subroutine uses matrix A as the input, and returns the determinant. All operations regarding LU decomposition are hidden in the subroutine.
| C++ | matdet subpackage | |
| C# | matdet subpackage |
This article is intended for personal use only.
C# source.
C++ source.
C++ source. MPFR/GMP is used.
GMP source is available from gmplib.org. MPFR source is available from www.mpfr.org.
FreePascal version.
Delphi version.
VB.NET version.
VBA version.
Python version (CPython and IronPython are supported).
|
ALGLIB® - numerical analysis library, 1999-2012. |