21#include "../base/base_uses.f90"
26 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
27 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_cfm_cholesky'
52 INTEGER,
INTENT(in),
OPTIONAL :: n
53 INTEGER,
INTENT(out),
OPTIONAL :: info_out
55 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_cfm_cholesky_decompose'
57 COMPLEX(kind=dp),
DIMENSION(:, :),
POINTER :: a
58 INTEGER :: handle, info, my_n
59#if defined(__parallel)
60 INTEGER,
DIMENSION(9) :: desca
65 CALL timeset(routinen, handle)
67 my_n = min(matrix%matrix_struct%nrow_global, &
68 matrix%matrix_struct%ncol_global)
74 a => matrix%local_data
76#if defined(__parallel)
77 desca(:) = matrix%matrix_struct%descriptor(:)
82 CALL pzpotrf(
'U', my_n, a(1, 1), 1, 1, desca, info)
86 CALL zpotrf(
'U', my_n, a(1, 1), lda, info)
89 IF (
PRESENT(info_out))
THEN
93 CALL cp_abort(__location__, &
94 "Cholesky decompose failed: matrix is not positive definite or ill-conditioned")
113 INTEGER,
INTENT(in),
OPTIONAL :: n
114 INTEGER,
INTENT(out),
OPTIONAL :: info_out
116 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_cfm_cholesky_invert'
117 COMPLEX(kind=dp),
DIMENSION(:, :),
POINTER :: aa
118 INTEGER :: info, handle
120#if defined(__parallel)
121 INTEGER,
DIMENSION(9) :: desca
124 CALL timeset(routinen, handle)
126 my_n = min(matrix%matrix_struct%nrow_global, &
127 matrix%matrix_struct%ncol_global)
133 aa => matrix%local_data
135#if defined(__parallel)
136 desca = matrix%matrix_struct%descriptor
137 CALL pzpotri(
'U', my_n, aa(1, 1), 1, 1, desca, info)
139 CALL zpotri(
'U', my_n, aa(1, 1),
SIZE(aa, 1), info)
142 IF (
PRESENT(info_out))
THEN
146 CALL cp_abort(__location__, &
147 "Cholesky invert failed: the matrix is not positive definite or ill-conditioned.")
150 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.
Defines the basic variable types.
integer, parameter, public dp
Represent a complex full matrix.