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)
214 blacs_context = matrix%matrix_struct%context%get_handle()
217 n = matrix%matrix_struct%nrow_global
219 a => matrix%local_data
220 z => eigenvectors%local_data
222 desca(:) = matrix%matrix_struct%descriptor(:)
223 descz(:) = eigenvectors%matrix_struct%descriptor(:)
226 CALL timeset(dlaf_name, dlaf_handle)
227 CALL dlaf_pzheevd(uplo, n, a, 1, 1, desca, eigenvalues, z, 1, 1, descz, info)
228 CALL timestop(dlaf_handle)
231 WRITE (message,
"(A,I0,A)")
"ERROR in DLAF_PZHEEVD: Eigensolver failed (INFO = ", info,
")"
232 cpabort(trim(message))
240 mark_used(eigenvectors)
241 mark_used(eigenvalues)
245 mark_used(dlaf_handle)
248 mark_used(blacs_context)
249 cpabort(
"CP2K compiled without DLAF library.")
252 CALL timestop(handle)
254 END SUBROUTINE cp_cfm_diag_dlaf_base
264 SUBROUTINE cp_cfm_diag_gen_dlaf_base(amatrix, bmatrix, eigenvectors, eigenvalues)
265 TYPE(
cp_cfm_type),
INTENT(IN) :: amatrix, bmatrix, eigenvectors
266 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT),
TARGET :: eigenvalues
268 CHARACTER(len=*),
PARAMETER :: dlaf_name =
'pzhegvd_dlaf', &
269 routinen =
'cp_cfm_diag_gen_dlaf_base'
270 CHARACTER,
PARAMETER :: uplo =
'L'
272 CHARACTER(LEN=100) :: message
273 COMPLEX(KIND=dp),
DIMENSION(:, :),
POINTER :: a, b, z
274 INTEGER :: blacs_context, dlaf_handle, handle, n
275 INTEGER,
DIMENSION(9) :: desca, descb, descz
276 INTEGER,
TARGET :: info
278 CALL timeset(routinen, handle)
287 blacs_context = amatrix%matrix_struct%context%get_handle()
290 n = amatrix%matrix_struct%nrow_global
292 a => amatrix%local_data
293 b => bmatrix%local_data
294 z => eigenvectors%local_data
296 desca(:) = amatrix%matrix_struct%descriptor(:)
297 descb(:) = bmatrix%matrix_struct%descriptor(:)
298 descz(:) = eigenvectors%matrix_struct%descriptor(:)
301 CALL timeset(dlaf_name, dlaf_handle)
302 CALL dlaf_pzhegvd(uplo, n, a, 1, 1, desca, b, 1, 1, descb, eigenvalues, z, 1, 1, descz, info)
303 CALL timestop(dlaf_handle)
306 WRITE (message,
"(A,I0,A)")
"ERROR in DLAF_PZHEGVD: Eigensolver failed (INFO = ", info,
")"
307 cpabort(trim(message))
318 mark_used(eigenvectors)
319 mark_used(eigenvalues)
323 mark_used(dlaf_handle)
326 mark_used(blacs_context)
327 cpabort(
"CP2K compiled without DLAF library.")
330 CALL timestop(handle)
332 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.