Alternative Cholesky decomposition of a matrix A This subroutine performs alternative Cholesky decomposition of a given symmetric positive definite matrix A, where L is a lower triangular matrix and D is a diagonal matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | A | ||
| real(kind=dp), | intent(out), | dimension(size(A, 1), size(A, 1)) | :: | L | ||
| real(kind=dp), | intent(out), | dimension(size(A, 1), size(A, 1)) | :: | D |
subroutine LDL_Cholesky_decomposition(A, L, D) real(dp), dimension(:, :), intent(in) :: A real(dp), dimension(size(A, 1), size(A, 1)), intent(out) :: L, D integer :: i, j, N, k N = size(A, 1) L = Identity_n(N) D = 0.d0 do j = 1, N D(j, j) = A(j, j) - & dot_product(L(j, 1:j - 1), L(j, 1:j - 1)*[(D(k, k), k=1, j - 1)]) do i = j + 1, N L(i, j) = (A(i, j) - & dot_product(L(i, 1:j - 1), L(j, 1:j - 1)*[(D(k, k), k=1, j - 1)])) / & D(j, j) end do end do end subroutine LDL_Cholesky_decomposition