22#include "../base/base_uses.f90"
27 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
28 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_cfm_cholesky'
54 INTEGER,
INTENT(in),
OPTIONAL :: n
55 INTEGER,
INTENT(out),
OPTIONAL :: info_out
57 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_cfm_cholesky_decompose'
59 COMPLEX(kind=dp),
DIMENSION(:, :),
POINTER :: a
60 INTEGER :: handle, info, my_n
61#if defined(__parallel)
62 INTEGER,
DIMENSION(9) :: desca
67 CALL timeset(routinen, handle)
69 my_n = min(matrix%matrix_struct%nrow_global, &
70 matrix%matrix_struct%ncol_global)
76 a => matrix%local_data
78#if defined(__parallel)
79 desca(:) = matrix%matrix_struct%descriptor(:)
91 CALL pzpotrf(
'U', my_n, a(1, 1), 1, 1, desca, info)
98 CALL zpotrf(
'U', my_n, a(1, 1), lda, info)
101 IF (
PRESENT(info_out))
THEN
105 CALL cp_abort(__location__, &
106 "Cholesky decompose failed: matrix is not positive definite or ill-conditioned")
109 CALL timestop(handle)
125 INTEGER,
INTENT(in),
OPTIONAL :: n
126 INTEGER,
INTENT(out),
OPTIONAL :: info_out
128 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_cfm_cholesky_invert'
129 COMPLEX(kind=dp),
DIMENSION(:, :),
POINTER :: aa
130 INTEGER :: info, handle
132#if defined(__parallel)
133 INTEGER,
DIMENSION(9) :: desca
136 CALL timeset(routinen, handle)
138 my_n = min(matrix%matrix_struct%nrow_global, &
139 matrix%matrix_struct%ncol_global)
145 aa => matrix%local_data
147#if defined(__parallel)
148 desca = matrix%matrix_struct%descriptor
149 CALL pzpotri(
'U', my_n, aa(1, 1), 1, 1, desca, info)
151 CALL zpotri(
'U', my_n, aa(1, 1),
SIZE(aa, 1), info)
154 IF (
PRESENT(info_out))
THEN
158 CALL cp_abort(__location__, &
159 "Cholesky invert failed: the matrix is not positive definite or ill-conditioned.")
162 CALL timestop(handle)
various cholesky decomposition related routines
subroutine, public cp_cfm_cholesky_decompose(matrix, n, info_out)
Used to replace a symmetric positive definite matrix M with its Cholesky decomposition U: M = U^T * U...
subroutine, public cp_cfm_cholesky_invert(matrix, n, info_out)
Used to replace Cholesky decomposition by the inverse.
subroutine, public cp_cfm_pzpotrf_dlaf(uplo, n, a, ia, ja, desca, info)
Cholesky factorization using DLA-Future.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_dlaf_create_grid(blacs_context)
Create DLA-Future grid from BLACS context.
subroutine, public cp_dlaf_initialize()
Initialize DLA-Future and pika runtime.
various cholesky decomposition related routines
integer, parameter, public fm_cholesky_type_dlaf
integer, save, public dlaf_cholesky_n_min
integer, save, public cholesky_type
Defines the basic variable types.
integer, parameter, public dp
Represent a complex full matrix.