Computes the LU factorization of an M-by-N matrix.
More...
Computes the LU factorization of an M-by-N matrix.
- Syntax
subroutine lu_factor(real(real64) a(:,:), integer(int32) ipvt(:), optional class(errors))
subroutine lu_factor(complex(real64) a(:,:), integer(int32) ipvt(:), optional class(errors))
- Parameters
-
[in,out] | a | On input, the M-by-N matrix on which to operate. On output, the LU factored matrix in the form [L\U] where the unit diagonal elements of L are not stored. |
[out] | ipvt | An MIN(M, N)-element array used to track row-pivot operations. The array stored pivot information such that row I is interchanged with row IPVT(I). |
[in,out] | err | An optional errors-based object that if provided can be used to retrieve information relating to any errors encountered during execution. If not provided, a default implementation of the errors class is used internally to provide error handling. Possible errors and warning messages that may be encountered are as follows.
- LA_ARRAY_SIZE_ERROR: Occurs if
ipvt is not sized appropriately.
- LA_SINGULAR_MATRIX_ERROR: Occurs as a warning if
a is found to be singular.
|
- Notes
- This routine utilizes the LAPACK routine DGETRF.
- See Also
-
- Usage
- To solve a system of 3 equations of 3 unknowns using LU factorization, the following code will suffice.
program example
use iso_fortran_env
implicit none
real(real64) :: a(3,3), b(3)
integer(int32) :: i, pvt(3)
a = reshape( &
[1.0d0, 4.0d0, 7.0d0, 2.0d0, 5.0d0, 8.0d0, 3.0d0, 6.0d0, 0.0d0], &
[3, 3])
b = [-1.0d0, -2.0d0, -3.0d0]
print '(A)', "LU Solution: X = "
print '(F8.4)', (b(i), i = 1, size(b))
end program
Computes the LU factorization of an M-by-N matrix.
Solves a system of LU-factored equations.
Provides a set of common linear algebra routines.
The program generates the following output. LU Solution: X =
0.3333
-0.6667
0.0000
Definition at line 555 of file linalg_core.f90.
The documentation for this interface was generated from the following file: