private called by junction solve
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:,:) | :: | A |
function inv(A) result(A_inv) !! private called by junction solve real(dp), dimension(:,:), intent(in) :: A real(dp), dimension(size(A,1),size(A,2)) :: A_inv real(dp), dimension(size(A,1)) :: work ! work array for LaPACK integer, dimension(size(A,1)) :: i_piv ! pivot indices integer :: n, info ! External procedures defined in LaPACK external DGETRF external DGETRI ! Store A in A_inv to prevent it from being overwritten by LaPACK A_inv = A n = size(A,1) ! DGETRF computes an LU factorization of a general M-by-N matrix A ! using partial pivoting with row interchanges. call DGETRF(n, n, A_inv, n, i_piv, info) if (info /= 0 ) then call set_error('matrix is numerically singular in junction inv(A)') return end if ! DGETRI computes the inverse of a matrix using the LU factorization ! computed by DGETRF. call DGETRI(n, A_inv, n, i_piv, work, n, info) if (info /= 0) then call set_error('matrix inversion failed in junction inv(A)') return end if end function inv