Cholesky decomposition of a matrix A This subroutine performs Cholesky decomposition of a given symmetric positive definite matrix A, where L is a lower triangular 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 |
subroutine Cholesky_decomposition(A, L) real(dp), dimension(:, :), intent(in) :: A real(dp), dimension(size(A, 1), size(A, 1)), intent(out) :: L integer :: i, j, N N = size(A, 1) do j = 1, N L(j, j) = sqrt(A(j, j) - dot_product(L(j, 1:j - 1), L(j, 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))) / L(j, j) end do end do end subroutine Cholesky_decomposition