LDL_Cholesky_decomposition Subroutine

public subroutine LDL_Cholesky_decomposition(A, L, D)

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.

Arguments

Type IntentOptional 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

Calls

proc~~ldl_cholesky_decomposition~~CallsGraph proc~ldl_cholesky_decomposition LDL_Cholesky_decomposition proc~identity_n Identity_n proc~ldl_cholesky_decomposition->proc~identity_n

Source Code

    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