next up previous contents
Next: Back-substitution Up: Homework Previous: Homework   Contents

LU decomposition

Write a routine that computes the LU decomposition of a matrix with partial pivoting.

Input arguments:

Output arguments:

The header and the declarations of this routine should be

subroutine LU_Fact(A,Pivot,Ierr)
implicit none
! The input matrix, at exit
! will hold the LU factorization
real, dimension(:,:), intent(inout) :: A
! Vector of permutations
integer, dimension(:), intent(out)   :: Pivot
! Singularity indicator, = 0 if A nonsingular,
! and = column number j if the first zero
! pivot was detected in column j
integer, intent(out)   :: Ierr
.....................................



Adrian Sandu 2001-08-26