14 USE dlaf_fortran,
ONLY: dlaf_pzheevd, &
20#include "../base/base_uses.f90"
26 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_cfm_dlaf_api'
45 CHARACTER,
INTENT(IN) :: uplo
46 INTEGER,
INTENT(IN) :: n
47 COMPLEX(KIND=dp),
DIMENSION(:, :),
TARGET :: a
48 INTEGER,
INTENT(IN) :: ia, ja
49 INTEGER,
DIMENSION(9) :: desca
50 INTEGER,
TARGET :: info
52 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_cfm_pzpotrf_dlaf'
56 CALL timeset(routinen, handle)
58 CALL dlaf_pzpotrf(uplo, n, a, ia, ja, desca, info)
67 cpabort(
"CP2K compiled without the DLA-Future library.")
84 CHARACTER,
INTENT(IN) :: uplo
85 INTEGER,
INTENT(IN) :: n
86 COMPLEX(KIND=dp),
DIMENSION(:, :),
TARGET :: a
87 INTEGER,
INTENT(IN) :: ia, ja
88 INTEGER,
DIMENSION(9) :: desca
89 INTEGER,
TARGET :: info
91 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_cfm_pzpotri_dlaf'
95 CALL timeset(routinen, handle)
97 CALL dlaf_pzpotri(uplo, n, a, ia, ja, desca, info)
106 cpabort(
"CP2K compiled without the DLA-Future library.")
108 CALL timestop(handle)
120 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix, eigenvectors
121 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: eigenvalues
123 CHARACTER(LEN=*),
PARAMETER :: routinen =
'cp_cfm_diag_dlaf'
125 INTEGER :: handle, n, nmo
126 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: eig
128 CALL timeset(routinen, handle)
130 n = matrix%matrix_struct%nrow_global
133 CALL cp_cfm_diag_dlaf_base(matrix, eigenvectors, eig)
135 nmo =
SIZE(eigenvalues, 1)
137 eigenvalues(1:n) = eig(1:n)
139 eigenvalues(1:nmo) = eig(1:nmo)
144 CALL timestop(handle)
158 TYPE(
cp_cfm_type),
INTENT(IN) :: amatrix, bmatrix, eigenvectors
159 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: eigenvalues
161 CHARACTER(LEN=*),
PARAMETER :: routinen =
'cp_cfm_diag_gen_dlaf'
163 INTEGER :: handle, n, nmo
164 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: eig
166 CALL timeset(routinen, handle)
168 n = amatrix%matrix_struct%nrow_global
171 CALL cp_cfm_diag_gen_dlaf_base(amatrix, bmatrix, eigenvectors, eig)
173 nmo =
SIZE(eigenvalues, 1)
175 eigenvalues(1:n) = eig(1:n)
177 eigenvalues(1:nmo) = eig(1:nmo)
182 CALL timestop(handle)
193 SUBROUTINE cp_cfm_diag_dlaf_base(matrix, eigenvectors, eigenvalues)
194 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix, eigenvectors
195 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT),
TARGET :: eigenvalues
197 CHARACTER(len=*),
PARAMETER :: dlaf_name =
'pzheevd_dlaf', routinen =
'cp_cfm_diag_dlaf_base'
198 CHARACTER,
PARAMETER :: uplo =
'L'
200 CHARACTER(LEN=100) :: message
201 COMPLEX(KIND=dp),
DIMENSION(:, :),
POINTER :: a, z
202 INTEGER :: blacs_context, dlaf_handle, handle, n
203 INTEGER,
DIMENSION(9) :: desca, descz
204 INTEGER,
TARGET :: info
206 CALL timeset(routinen, handle)
213 blacs_context = matrix%matrix_struct%context%get_handle()
216 n = matrix%matrix_struct%nrow_global
218 a => matrix%local_data
219 z => eigenvectors%local_data
221 desca(:) = matrix%matrix_struct%descriptor(:)
222 descz(:) = eigenvectors%matrix_struct%descriptor(:)
225 CALL timeset(dlaf_name, dlaf_handle)
226 CALL dlaf_pzheevd(uplo, n, a, 1, 1, desca, eigenvalues, z, 1, 1, descz, info)
227 CALL timestop(dlaf_handle)
230 WRITE (message,
"(A,I0,A)")
"ERROR in DLAF_PZHEEVD: Eigensolver failed (INFO = ", info,
")"
231 cpabort(trim(message))
239 mark_used(eigenvectors)
240 mark_used(eigenvalues)
244 mark_used(dlaf_handle)
247 mark_used(blacs_context)
248 cpabort(
"CP2K compiled without DLAF library.")
251 CALL timestop(handle)
253 END SUBROUTINE cp_cfm_diag_dlaf_base
263 SUBROUTINE cp_cfm_diag_gen_dlaf_base(amatrix, bmatrix, eigenvectors, eigenvalues)
264 TYPE(
cp_cfm_type),
INTENT(IN) :: amatrix, bmatrix, eigenvectors
265 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT),
TARGET :: eigenvalues
267 CHARACTER(len=*),
PARAMETER :: dlaf_name =
'pzhegvd_dlaf', &
268 routinen =
'cp_cfm_diag_gen_dlaf_base'
269 CHARACTER,
PARAMETER :: uplo =
'L'
271 CHARACTER(LEN=100) :: message
272 COMPLEX(KIND=dp),
DIMENSION(:, :),
POINTER :: a, b, z
273 INTEGER :: blacs_context, dlaf_handle, handle, n
274 INTEGER,
DIMENSION(9) :: desca, descb, descz
275 INTEGER,
TARGET :: info
277 CALL timeset(routinen, handle)
285 blacs_context = amatrix%matrix_struct%context%get_handle()
288 n = amatrix%matrix_struct%nrow_global
290 a => amatrix%local_data
291 b => bmatrix%local_data
292 z => eigenvectors%local_data
294 desca(:) = amatrix%matrix_struct%descriptor(:)
295 descb(:) = bmatrix%matrix_struct%descriptor(:)
296 descz(:) = eigenvectors%matrix_struct%descriptor(:)
299 CALL timeset(dlaf_name, dlaf_handle)
300 CALL dlaf_pzhegvd(uplo, n, a, 1, 1, desca, b, 1, 1, descb, eigenvalues, z, 1, 1, descz, info)
301 CALL timestop(dlaf_handle)
304 WRITE (message,
"(A,I0,A)")
"ERROR in DLAF_PZHEGVD: Eigensolver failed (INFO = ", info,
")"
305 cpabort(trim(message))
316 mark_used(eigenvectors)
317 mark_used(eigenvalues)
321 mark_used(dlaf_handle)
324 mark_used(blacs_context)
325 cpabort(
"CP2K compiled without DLAF library.")
328 CALL timestop(handle)
330 END SUBROUTINE cp_cfm_diag_gen_dlaf_base
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_uplo_to_full(matrix, workspace, uplo)
...
subroutine, public cp_cfm_diag_dlaf(matrix, eigenvectors, eigenvalues)
DLA-Future eigensolver for complex Hermitian matrices.
subroutine, public cp_cfm_pzpotrf_dlaf(uplo, n, a, ia, ja, desca, info)
Cholesky factorization using DLA-Future.
subroutine, public cp_cfm_pzpotri_dlaf(uplo, n, a, ia, ja, desca, info)
Inverse from Cholesky factorization using DLA-Future.
subroutine, public cp_cfm_diag_gen_dlaf(amatrix, bmatrix, eigenvectors, eigenvalues)
DLA-Future generalized eigensolver for complex Hermitian matrices.
Represents a complex full matrix distributed on many processors.
subroutine, public cp_dlaf_create_grid(blacs_context)
Create DLA-Future grid from BLACS context.
Defines the basic variable types.
integer, parameter, public dp
Represent a complex full matrix.