14 USE dlaf_fortran,
ONLY: dlaf_pzheevd, &
19#include "../base/base_uses.f90"
25 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_cfm_dlaf_api'
44 CHARACTER,
INTENT(IN) :: uplo
45 INTEGER,
INTENT(IN) :: n
46 COMPLEX(KIND=dp),
DIMENSION(:, :),
TARGET :: a
47 INTEGER,
INTENT(IN) :: ia, ja
48 INTEGER,
DIMENSION(9) :: desca
49 INTEGER,
TARGET :: info
51 CHARACTER(len=*),
PARAMETER :: routinen =
'cp_cfm_pzpotrf_dlaf'
55 CALL timeset(routinen, handle)
57 CALL dlaf_pzpotrf(uplo, n, a, ia, ja, desca, info)
66 cpabort(
"CP2K compiled without the DLA-Future library.")
80 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix, eigenvectors
81 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: eigenvalues
83 CHARACTER(LEN=*),
PARAMETER :: routinen =
'cp_cfm_diag_dlaf'
85 INTEGER :: handle, n, nmo
86 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: eig
88 CALL timeset(routinen, handle)
90 n = matrix%matrix_struct%nrow_global
93 CALL cp_cfm_diag_dlaf_base(matrix, eigenvectors, eig)
95 nmo =
SIZE(eigenvalues, 1)
97 eigenvalues(1:n) = eig(1:n)
99 eigenvalues(1:nmo) = eig(1:nmo)
104 CALL timestop(handle)
118 TYPE(
cp_cfm_type),
INTENT(IN) :: amatrix, bmatrix, eigenvectors
119 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT) :: eigenvalues
121 CHARACTER(LEN=*),
PARAMETER :: routinen =
'cp_cfm_diag_gen_dlaf'
123 INTEGER :: handle, n, nmo
124 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: eig
126 CALL timeset(routinen, handle)
128 n = amatrix%matrix_struct%nrow_global
131 CALL cp_cfm_diag_gen_dlaf_base(amatrix, bmatrix, eigenvectors, eig)
133 nmo =
SIZE(eigenvalues, 1)
135 eigenvalues(1:n) = eig(1:n)
137 eigenvalues(1:nmo) = eig(1:nmo)
142 CALL timestop(handle)
153 SUBROUTINE cp_cfm_diag_dlaf_base(matrix, eigenvectors, eigenvalues)
154 TYPE(
cp_cfm_type),
INTENT(IN) :: matrix, eigenvectors
155 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT),
TARGET :: eigenvalues
157 CHARACTER(len=*),
PARAMETER :: dlaf_name =
'pzheevd_dlaf', routinen =
'cp_cfm_diag_dlaf_base'
158 CHARACTER,
PARAMETER :: uplo =
'L'
160 CHARACTER(LEN=100) :: message
161 COMPLEX(KIND=dp),
DIMENSION(:, :),
POINTER :: a, z
162 INTEGER :: blacs_context, dlaf_handle, handle, n
163 INTEGER,
DIMENSION(9) :: desca, descz
164 INTEGER,
TARGET :: info
166 CALL timeset(routinen, handle)
173 blacs_context = matrix%matrix_struct%context%get_handle()
176 n = matrix%matrix_struct%nrow_global
178 a => matrix%local_data
179 z => eigenvectors%local_data
181 desca(:) = matrix%matrix_struct%descriptor(:)
182 descz(:) = eigenvectors%matrix_struct%descriptor(:)
185 CALL timeset(dlaf_name, dlaf_handle)
186 CALL dlaf_pzheevd(uplo, n, a, 1, 1, desca, eigenvalues, z, 1, 1, descz, info)
187 CALL timestop(dlaf_handle)
190 WRITE (message,
"(A,I0,A)")
"ERROR in DLAF_PZHEEVD: Eigensolver failed (INFO = ", info,
")"
191 cpabort(trim(message))
199 mark_used(eigenvectors)
200 mark_used(eigenvalues)
204 mark_used(dlaf_handle)
207 mark_used(blacs_context)
208 cpabort(
"CP2K compiled without DLAF library.")
211 CALL timestop(handle)
213 END SUBROUTINE cp_cfm_diag_dlaf_base
223 SUBROUTINE cp_cfm_diag_gen_dlaf_base(amatrix, bmatrix, eigenvectors, eigenvalues)
224 TYPE(
cp_cfm_type),
INTENT(IN) :: amatrix, bmatrix, eigenvectors
225 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT),
TARGET :: eigenvalues
227 CHARACTER(len=*),
PARAMETER :: dlaf_name =
'pzhegvd_dlaf', &
228 routinen =
'cp_cfm_diag_gen_dlaf_base'
229 CHARACTER,
PARAMETER :: uplo =
'L'
231 CHARACTER(LEN=100) :: message
232 COMPLEX(KIND=dp),
DIMENSION(:, :),
POINTER :: a, b, z
233 INTEGER :: blacs_context, dlaf_handle, handle, n
234 INTEGER,
DIMENSION(9) :: desca, descb, descz
235 INTEGER,
TARGET :: info
237 CALL timeset(routinen, handle)
245 blacs_context = amatrix%matrix_struct%context%get_handle()
248 n = amatrix%matrix_struct%nrow_global
250 a => amatrix%local_data
251 b => bmatrix%local_data
252 z => eigenvectors%local_data
254 desca(:) = amatrix%matrix_struct%descriptor(:)
255 descb(:) = bmatrix%matrix_struct%descriptor(:)
256 descz(:) = eigenvectors%matrix_struct%descriptor(:)
259 CALL timeset(dlaf_name, dlaf_handle)
260 CALL dlaf_pzhegvd(uplo, n, a, 1, 1, desca, b, 1, 1, descb, eigenvalues, z, 1, 1, descz, info)
261 CALL timestop(dlaf_handle)
264 WRITE (message,
"(A,I0,A)")
"ERROR in DLAF_PZHEGVD: Eigensolver failed (INFO = ", info,
")"
265 cpabort(trim(message))
276 mark_used(eigenvectors)
277 mark_used(eigenvalues)
281 mark_used(dlaf_handle)
284 mark_used(blacs_context)
285 cpabort(
"CP2K compiled without DLAF library.")
288 CALL timestop(handle)
290 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_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.