Eigenvalue SoLvers for Petaflop-Applications (ELPA) 2025.01.002
Loading...
Searching...
No Matches
elpa_api_math_template.F90
Go to the documentation of this file.
1#if 0
2!
3! Copyright 2017, L. Hüdepohl and A. Marek, MPCDF
4!
5! This file is part of ELPA.
6!
7! The ELPA library was originally created by the ELPA consortium,
8! consisting of the following organizations:
9!
10! - Max Planck Computing and Data Facility (MPCDF), formerly known as
11! Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
12! - Bergische Universität Wuppertal, Lehrstuhl für angewandte
13! Informatik,
14! - Technische Universität München, Lehrstuhl für Informatik mit
15! Schwerpunkt Wissenschaftliches Rechnen ,
16! - Fritz-Haber-Institut, Berlin, Abt. Theorie,
17! - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
18! Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
19! and
20! - IBM Deutschland GmbH
21!
22! This particular source code file contains additions, changes and
23! enhancements authored by Intel Corporation which is not part of
24! the ELPA consortium.
25!
26! More information can be found here:
27! http://elpa.mpcdf.mpg.de/
28!
29! ELPA is free software: you can redistribute it and/or modify
30! it under the terms of the version 3 of the license of the
31! GNU Lesser General Public License as published by the Free
32! Software Foundation.
33!
34! ELPA is distributed in the hope that it will be useful,
35! but WITHOUT ANY WARRANTY; without even the implied warranty of
36! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37! GNU Lesser General Public License for more details.
38!
39! You should have received a copy of the GNU Lesser General Public License
40! along with ELPA. If not, see <http://www.gnu.org/licenses/>
41!
42! ELPA reflects a substantial effort on the part of the original
43! ELPA consortium, and we ask you to respect the spirit of the
44! license that we chose: i.e., please contribute any changes you
45! may have back to the original ELPA library distribution, and keep
46! any derivatives of ELPA under the same license that we chose for
47! the original distribution, the GNU Lesser General Public License.
48!
49#endif
50
51 !> \brief abstract definition of interface to solve eigenvector problem
52 !>
53 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
54 !> blocksize, the number of eigenvectors
55 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
56 !> with the class method "setup"
57 !>
58 !> It is possible to change the behaviour of the method by setting tunable parameters with the
59 !> class method "set"
60 !> Parameters
61 !> \details
62 !> \param self class(elpa_t), the ELPA object
63#if ELPA_IMPL_SUFFIX == d
64 !> \param a double real matrix a: defines the problem to solve
65 !> \param ev double real: on output stores the eigenvalues
66 !> \param q double real matrix q: on output stores the eigenvectors
67#endif
68#if ELPA_IMPL_SUFFIX == f
69 !> \param a single real matrix a: defines the problem to solve
70 !> \param ev single real: on output stores the eigenvalues
71 !> \param q single real matrix q: on output stores the eigenvectors
72#endif
73#if ELPA_IMPL_SUFFIX == dc
74 !> \param a double complex matrix a: defines the problem to solve
75 !> \param ev double real: on output stores the eigenvalues
76 !> \param q double complex matrix q: on output stores the eigenvectors
77#endif
78#if ELPA_IMPL_SUFFIX == fc
79 !> \param a single complex matrix a: defines the problem to solve
80 !> \param ev single real: on output stores the eigenvalues
81 !> \param q single complex matrix q: on output stores the eigenvectors
82#endif
83 !> \result error integer, optional : error code, which can be queried with elpa_strerr
84 abstract interface
85 subroutine elpa_eigenvectors_a_h_a_&
86 &elpa_impl_suffix&
87 &_i(self, a, ev, q, error)
88 use, intrinsic :: iso_c_binding
89 import elpa_t
90 implicit none
91 class(elpa_t) :: self
92
93#ifdef USE_ASSUMED_SIZE
94 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, *), q(self%local_nrows,*)
95#else
96 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols)
97#endif
98 real(kind=c_real_datatype) :: ev(self%na)
99
100#ifdef USE_FORTRAN2008
101 integer, optional :: error
102#else
103 integer :: error
104#endif
105 end subroutine
106 end interface
107
108
109 !> \brief abstract definition of interface to solve eigenvector problem, using device pointers
110 !>
111 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
112 !> blocksize, the number of eigenvectors
113 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
114 !> with the class method "setup"
115 !>
116 !> It is possible to change the behaviour of the method by setting tunable parameters with the
117 !> class method "set"
118 !> Parameters
119 !> \details
120 !> \param self class(elpa_t), the ELPA object
121#if ELPA_IMPL_SUFFIX == d
122 !> \param a double real matrix a: defines the problem to solve
123 !> \param ev double real: on output stores the eigenvalues
124 !> \param q double real matrix q: on output stores the eigenvectors
125#endif
126#if ELPA_IMPL_SUFFIX == f
127 !> \param a single real matrix a: defines the problem to solve
128 !> \param ev single real: on output stores the eigenvalues
129 !> \param q single real matrix q: on output stores the eigenvectors
130#endif
131#if ELPA_IMPL_SUFFIX == dc
132 !> \param a double complex matrix a: defines the problem to solve
133 !> \param ev double real: on output stores the eigenvalues
134 !> \param q double complex matrix q: on output stores the eigenvectors
135#endif
136#if ELPA_IMPL_SUFFIX == fc
137 !> \param a single complex matrix a: defines the problem to solve
138 !> \param ev single real: on output stores the eigenvalues
139 !> \param q single complex matrix q: on output stores the eigenvectors
140#endif
141 !> \result error integer, optional : error code, which can be queried with elpa_strerr
142 abstract interface
143 subroutine elpa_eigenvectors_d_ptr_&
144 &elpa_impl_suffix&
145 &_i(self, a, ev, q, error)
146 use, intrinsic :: iso_c_binding
147 import elpa_t
148 implicit none
149 class(elpa_t) :: self
150
151 type(c_ptr) :: a, q, ev
152
153#ifdef USE_FORTRAN2008
154 integer, optional :: error
155#else
156 integer :: error
157#endif
158 end subroutine
159 end interface
160
161
162#ifdef HAVE_SKEWSYMMETRIC
163 !> \brief abstract definition of interface to solve double real skew-symmetric eigenvalue problem
164 !>
165 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
166 !> blocksize, the number of eigenvectors
167 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
168 !> with the class method "setup"
169 !>
170 !> It is possible to change the behaviour of the method by setting tunable parameters with the
171 !> class method "set"
172 !> Parameters
173 !> \details
174 !> \param self class(elpa_t), the ELPA object
175#if ELPA_IMPL_SUFFIX == d
176 !> \param a double real matrix a: defines the problem to solve
177 !> \param ev double real: on output stores the eigenvalues
178 !> \param q double real matrix q: on output stores the eigenvectors
179#endif
180#if ELPA_IMPL_SUFFIX == f
181 !> \param a single real matrix a: defines the problem to solve
182 !> \param ev single real: on output stores the eigenvalues
183 !> \param q single real matrix q: on output stores the eigenvectors
184#endif
185 !> \result error integer, optional : error code, which can be queried with elpa_strerr
186 abstract interface
187 subroutine elpa_skew_eigenvectors_a_h_a_&
188 &elpa_impl_suffix&
189 &_i(self, a, ev, q, error)
190 use, intrinsic :: iso_c_binding
191 import elpa_t
192 implicit none
193 class(elpa_t) :: self
194
195#ifdef USE_ASSUMED_SIZE
196 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, *), q(self%local_nrows,*)
197#else
198 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, 2*self%local_ncols)
199#endif
200 real(kind=c_real_datatype) :: ev(self%na)
201
202#ifdef USE_FORTRAN2008
203 integer, optional :: error
204#else
205 integer :: error
206#endif
207 end subroutine
208 end interface
209
210
211 !> \brief abstract definition of interface to solve double real skew-symmetric eigenvalue problem
212 !>
213 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
214 !> blocksize, the number of eigenvectors
215 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
216 !> with the class method "setup"
217 !>
218 !> It is possible to change the behaviour of the method by setting tunable parameters with the
219 !> class method "set"
220 !> Parameters
221 !> \details
222 !> \param self class(elpa_t), the ELPA object
223#if ELPA_IMPL_SUFFIX == d
224 !> \param a double real matrix a: defines the problem to solve
225 !> \param ev double real: on output stores the eigenvalues
226 !> \param q double real matrix q: on output stores the eigenvectors
227#endif
228#if ELPA_IMPL_SUFFIX == f
229 !> \param a single real matrix a: defines the problem to solve
230 !> \param ev single real: on output stores the eigenvalues
231 !> \param q single real matrix q: on output stores the eigenvectors
232#endif
233 !> \result error integer, optional : error code, which can be queried with elpa_strerr
234 abstract interface
235 subroutine elpa_skew_eigenvectors_d_ptr_&
236 &elpa_impl_suffix&
237 &_i(self, a, ev, q, error)
238 use, intrinsic :: iso_c_binding
239 import elpa_t
240 implicit none
241 class(elpa_t) :: self
242
243 type(c_ptr) :: a, q, ev
244
245#ifdef USE_FORTRAN2008
246 integer, optional :: error
247#else
248 integer :: error
249#endif
250 end subroutine
251 end interface
252
253#endif /* HAVE_SKEWSYMMETRIC */
254
255
256 !> \brief abstract definition of interface to solve a eigenvalue problem
257 !>
258 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
259 !> blocksize, the number of eigenvectors
260 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
261 !> with the class method "setup"
262 !>
263 !> It is possible to change the behaviour of the method by setting tunable parameters with the
264 !> class method "set"
265 !> Parameters
266 !> \details
267 !> \param self class(elpa_t), the ELPA object
268#if ELPA_IMPL_SUFFIX == d
269 !> \param a double real matrix a: defines the problem to solve
270 !> \param ev double real: on output stores the eigenvalues
271#endif
272#if ELPA_IMPL_SUFFIX == f
273 !> \param a single real matrix a: defines the problem to solve
274 !> \param ev single real: on output stores the eigenvalues
275#endif
276#if ELPA_IMPL_SUFFIX == dc
277 !> \param a double complex matrix a: defines the problem to solve
278 !> \param ev double real: on output stores the eigenvalues
279#endif
280#if ELPA_IMPL_SUFFIX ==fc
281 !> \param a single complex matrix a: defines the problem to solve
282 !> \param ev single real: on output stores the eigenvalues
283#endif
284 !> \result error integer, optional : error code, which can be queried with elpa_strerr
285 abstract interface
286 subroutine elpa_eigenvalues_a_h_a_&
287 &elpa_impl_suffix&
288 &_i(self, a, ev, error)
289 use, intrinsic :: iso_c_binding
290 import elpa_t
291 implicit none
292 class(elpa_t) :: self
293#ifdef USE_ASSUMED_SIZE
294 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, *)
295#else
296 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, self%local_ncols)
297#endif
298 real(kind=c_real_datatype) :: ev(self%na)
299
300#ifdef USE_FORTRAN2008
301 integer, optional :: error
302#else
303 integer :: error
304#endif
305 end subroutine
306 end interface
307
308
309 !> \brief abstract definition of interface to solve a eigenvalue problem
310 !>
311 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
312 !> blocksize, the number of eigenvectors
313 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
314 !> with the class method "setup"
315 !>
316 !> It is possible to change the behaviour of the method by setting tunable parameters with the
317 !> class method "set"
318 !> Parameters
319 !> \details
320 !> \param self class(elpa_t), the ELPA object
321#if ELPA_IMPL_SUFFIX == d
322 !> \param a double real matrix a: defines the problem to solve
323 !> \param ev double real: on output stores the eigenvalues
324#endif
325#if ELPA_IMPL_SUFFIX == f
326 !> \param a single real matrix a: defines the problem to solve
327 !> \param ev single real: on output stores the eigenvalues
328#endif
329#if ELPA_IMPL_SUFFIX == dc
330 !> \param a double complex matrix a: defines the problem to solve
331 !> \param ev double real: on output stores the eigenvalues
332#endif
333#if ELPA_IMPL_SUFFIX ==fc
334 !> \param a single complex matrix a: defines the problem to solve
335 !> \param ev single real: on output stores the eigenvalues
336#endif
337 !> \result error integer, optional : error code, which can be queried with elpa_strerr
338 abstract interface
339 subroutine elpa_eigenvalues_d_ptr_&
340 &elpa_impl_suffix&
341 &_i(self, a, ev, error)
342 use, intrinsic :: iso_c_binding
343 import elpa_t
344 implicit none
345 class(elpa_t) :: self
346 type(c_ptr) :: a, ev
347
348#ifdef USE_FORTRAN2008
349 integer, optional :: error
350#else
351 integer :: error
352#endif
353 end subroutine
354 end interface
355
356
357#ifdef HAVE_SKEWSYMMETRIC
358 !> \brief abstract definition of interface to solve a skew-symmetric eigenvalue problem
359 !>
360 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
361 !> blocksize, the number of eigenvectors
362 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
363 !> with the class method "setup"
364 !>
365 !> It is possible to change the behaviour of the method by setting tunable parameters with the
366 !> class method "set"
367 !> Parameters
368 !> \details
369 !> \param self class(elpa_t), the ELPA object
370#if ELPA_IMPL_SUFFIX == d
371 !> \param a double real matrix a: defines the problem to solve
372 !> \param ev double real: on output stores the eigenvalues
373#endif
374#if ELPA_IMPL_SUFFIX == f
375 !> \param a single real matrix a: defines the problem to solve
376 !> \param ev single real: on output stores the eigenvalues
377#endif
378 !> \result error integer, optional : error code, which can be queried with elpa_strerr
379 abstract interface
380 subroutine elpa_skew_eigenvalues_a_h_a_&
381 &elpa_impl_suffix&
382 &_i(self, a, ev, error)
383 use, intrinsic :: iso_c_binding
384 import elpa_t
385 implicit none
386 class(elpa_t) :: self
387#ifdef USE_ASSUMED_SIZE
388 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, *)
389#else
390 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, self%local_ncols)
391#endif
392 real(kind=c_real_datatype) :: ev(self%na)
393
394#ifdef USE_FORTRAN2008
395 integer, optional :: error
396#else
397 integer :: error
398#endif
399 end subroutine
400 end interface
401
402
403 !> \brief abstract definition of interface to solve a skew-symmetric eigenvalue problem
404 !>
405 !> The dimensions of the matrix a (locally distributed and global), the block-cyclic distribution
406 !> blocksize, the number of eigenvectors
407 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
408 !> with the class method "setup"
409 !>
410 !> It is possible to change the behaviour of the method by setting tunable parameters with the
411 !> class method "set"
412 !> Parameters
413 !> \details
414 !> \param self class(elpa_t), the ELPA object
415#if ELPA_IMPL_SUFFIX == d
416 !> \param a double real matrix a: defines the problem to solve
417 !> \param ev double real: on output stores the eigenvalues
418#endif
419#if ELPA_IMPL_SUFFIX == f
420 !> \param a single real matrix a: defines the problem to solve
421 !> \param ev single real: on output stores the eigenvalues
422#endif
423 !> \result error integer, optional : error code, which can be queried with elpa_strerr
424 abstract interface
425 subroutine elpa_skew_eigenvalues_d_ptr_&
426 &elpa_impl_suffix&
427 &_i(self, a, ev, error)
428 use, intrinsic :: iso_c_binding
429 import elpa_t
430 implicit none
431 class(elpa_t) :: self
432 type(c_ptr) :: a, ev
433
434#ifdef USE_FORTRAN2008
435 integer, optional :: error
436#else
437 integer :: error
438#endif
439 end subroutine
440 end interface
441#endif /* HAVE_SKEWSYMMETRIC */
442
443! _________________________________________________________________________________________________
444
445 !> \brief abstract definition of interface to solve a generalized eigenvector problem, using host arrays
446 !>
447 !> The dimensions of the matrix a and b (locally distributed and global), the block-cyclic distribution
448 !> blocksize, the number of eigenvectors
449 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
450 !> with the class method "setup"
451 !>
452 !> It is possible to change the behaviour of the method by setting tunable parameters with the
453 !> class method "set"
454 !> Parameters
455 !> \details
456 !> \param self class(elpa_t), the ELPA object
457#if ELPA_IMPL_SUFFIX == d
458 !> \param a double real matrix a: defines the problem to solve
459 !> \param b double real matrix b: defines the problem to solve
460 !> \param ev double real: on output stores the eigenvalues
461 !> \param q double real matrix q: on output stores the eigenvalues
462#endif
463#if ELPA_IMPL_SUFFIX == f
464 !> \param a single real matrix a: defines the problem to solve
465 !> \param b single real matrix b: defines the problem to solve
466 !> \param ev single real: on output stores the eigenvalues
467 !> \param q single real matrix q: on output stores the eigenvalues
468#endif
469#if ELPA_IMPL_SUFFIX == dc
470 !> \param a double complex matrix a: defines the problem to solve
471 !> \param b double complex matrix b: defines the problem to solve
472 !> \param ev double real: on output stores the eigenvalues
473 !> \param q double complex matrix q: on output stores the eigenvalues
474#endif
475#if ELPA_IMPL_SUFFIX == fc
476 !> \param a single complex matrix a: defines the problem to solve
477 !> \param b single complex matrix b: defines the problem to solve
478 !> \param ev single real: on output stores the eigenvalues
479 !> \param q single complex matrix q: on output stores the eigenvalues
480#endif
481 !> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
482 !> \result error integer, optional : error code, which can be queried with elpa_strerr
483 abstract interface
484 subroutine elpa_generalized_eigenvectors_a_h_a_&
485 &elpa_impl_suffix&
486 &_i(self, a, b, ev, q, is_already_decomposed, error)
487 use, intrinsic :: iso_c_binding
488 use elpa_constants
489 import elpa_t
490 implicit none
491 class(elpa_t) :: self
492#ifdef USE_ASSUMED_SIZE
493 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, *), b(self%local_nrows, *), q(self%local_nrows, *)
494#else
495 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, self%local_ncols), b(self%local_nrows, self%local_ncols), &
496 q(self%local_nrows, self%local_ncols)
497#endif
498 real(kind=c_real_datatype) :: ev(self%na)
499
500 logical :: is_already_decomposed
501 integer, optional :: error
502 end subroutine
503 end interface
504
505
506 !> \brief abstract definition of interface to solve a generalized eigenvector problem, using device pointers
507 !>
508 !> The dimensions of the matrix a and b (locally distributed and global), the block-cyclic distribution
509 !> blocksize, the number of eigenvectors
510 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
511 !> with the class method "setup"
512 !>
513 !> It is possible to change the behaviour of the method by setting tunable parameters with the
514 !> class method "set"
515 !> Parameters
516 !> \details
517 !> \param self class(elpa_t), the ELPA object
518#if ELPA_IMPL_SUFFIX == d
519 !> \param a double real matrix a: defines the problem to solve
520 !> \param b double real matrix b: defines the problem to solve
521 !> \param ev double real: on output stores the eigenvalues
522 !> \param q double real matrix q: on output stores the eigenvalues
523#endif
524#if ELPA_IMPL_SUFFIX == f
525 !> \param a single real matrix a: defines the problem to solve
526 !> \param b single real matrix b: defines the problem to solve
527 !> \param ev single real: on output stores the eigenvalues
528 !> \param q single real matrix q: on output stores the eigenvalues
529#endif
530#if ELPA_IMPL_SUFFIX == dc
531 !> \param a double complex matrix a: defines the problem to solve
532 !> \param b double complex matrix b: defines the problem to solve
533 !> \param ev double real: on output stores the eigenvalues
534 !> \param q double complex matrix q: on output stores the eigenvalues
535#endif
536#if ELPA_IMPL_SUFFIX == fc
537 !> \param a single complex matrix a: defines the problem to solve
538 !> \param b single complex matrix b: defines the problem to solve
539 !> \param ev single real: on output stores the eigenvalues
540 !> \param q single complex matrix q: on output stores the eigenvalues
541#endif
542 !> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
543 !> \result error integer, optional : error code, which can be queried with elpa_strerr
544 abstract interface
545 subroutine elpa_generalized_eigenvectors_d_ptr_&
546 &elpa_impl_suffix&
547 &_i(self, adev, bdev, evdev, qdev, is_already_decomposed, error)
548 use, intrinsic :: iso_c_binding
549 use elpa_constants
550 import elpa_t
551 implicit none
552 class(elpa_t) :: self
553
554 type(c_ptr) :: aDev, bDev, evDev, qDev
555
556 logical :: is_already_decomposed
557 integer, optional :: error
558 end subroutine
559 end interface
560
561! _________________________________________________________________________________________________
562
563 !> \brief abstract definition of interface to solve a generalized eigenvalue problem, using host arrays
564 !>
565 !> The dimensions of the matrix a and b (locally distributed and global), the block-cyclic distribution
566 !> blocksize, the number of eigenvectors
567 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
568 !> with the class method "setup"
569 !>
570 !> It is possible to change the behaviour of the method by setting tunable parameters with the
571 !> class method "set"
572 !> Parameters
573 !> \details
574 !> \param self class(elpa_t), the ELPA object
575#if ELPA_IMPL_SUFFIX == d
576 !> \param a double real matrix a: defines the problem to solve
577 !> \param b double real matrix b: defines the problem to solve
578 !> \param ev double real: on output stores the eigenvalues
579#endif
580#if ELPA_IMPL_SUFFIX == f
581 !> \param a single real matrix a: defines the problem to solve
582 !> \param b single real matrix b: defines the problem to solve
583 !> \param ev single real: on output stores the eigenvalues
584#endif
585#if ELPA_IMPL_SUFFIX == dc
586 !> \param a double complex matrix a: defines the problem to solve
587 !> \param b double complex matrix b: defines the problem to solve
588 !> \param ev double real: on output stores the eigenvalues
589#endif
590#if ELPA_IMPL_SUFFIX == fc
591 !> \param a single complex matrix a: defines the problem to solve
592 !> \param b single complex matrix b: defines the problem to solve
593 !> \param ev single real: on output stores the eigenvalues
594#endif
595
596 !> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
597 !> \result error integer, optional : error code, which can be queried with elpa_strerr
598 abstract interface
599 subroutine elpa_generalized_eigenvalues_a_h_a_&
600 &elpa_impl_suffix&
601 &_i(self, a, b, ev, is_already_decomposed, error)
602 use, intrinsic :: iso_c_binding
603 use elpa_constants
604 import elpa_t
605 implicit none
606 class(elpa_t) :: self
607#ifdef USE_ASSUMED_SIZE
608 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, *), b(self%local_nrows, *)
609#else
610 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows, self%local_ncols), b(self%local_nrows, self%local_ncols)
611#endif
612 real(kind=c_real_datatype) :: ev(self%na)
613
614 logical :: is_already_decomposed
615 integer, optional :: error
616 end subroutine
617 end interface
618
619
620 !> \brief abstract definition of interface to solve a generalized eigenvalue problem, using device pointers
621 !>
622 !> The dimensions of the matrix a and b (locally distributed and global), the block-cyclic distribution
623 !> blocksize, the number of eigenvectors
624 !> to be computed and the MPI communicators are already known to the object and MUST be set BEFORE
625 !> with the class method "setup"
626 !>
627 !> It is possible to change the behaviour of the method by setting tunable parameters with the
628 !> class method "set"
629 !> Parameters
630 !> \details
631 !> \param self class(elpa_t), the ELPA object
632#if ELPA_IMPL_SUFFIX == d
633 !> \param a double real matrix a: defines the problem to solve
634 !> \param b double real matrix b: defines the problem to solve
635 !> \param ev double real: on output stores the eigenvalues
636#endif
637#if ELPA_IMPL_SUFFIX == f
638 !> \param a single real matrix a: defines the problem to solve
639 !> \param b single real matrix b: defines the problem to solve
640 !> \param ev single real: on output stores the eigenvalues
641#endif
642#if ELPA_IMPL_SUFFIX == dc
643 !> \param a double complex matrix a: defines the problem to solve
644 !> \param b double complex matrix b: defines the problem to solve
645 !> \param ev double real: on output stores the eigenvalues
646#endif
647#if ELPA_IMPL_SUFFIX == fc
648 !> \param a single complex matrix a: defines the problem to solve
649 !> \param b single complex matrix b: defines the problem to solve
650 !> \param ev single real: on output stores the eigenvalues
651#endif
652
653 !> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
654 !> \result error integer, optional : error code, which can be queried with elpa_strerr
655 abstract interface
656 subroutine elpa_generalized_eigenvalues_d_ptr_&
657 &elpa_impl_suffix&
658 &_i(self, adev, bdev, evdev, is_already_decomposed, error)
659 use, intrinsic :: iso_c_binding
660 use elpa_constants
661 import elpa_t
662 implicit none
663 class(elpa_t) :: self
664
665 type(c_ptr) :: aDev, bDev, evDev
666
667 logical :: is_already_decomposed
668 integer, optional :: error
669 end subroutine
670 end interface
671
672! _________________________________________________________________________________________________
673
674 !> \brief abstract definition of interface to compute C : = A**T * B
675 !> where A is a square matrix (self%a,self%na) which is optionally upper or lower triangular
676 !> B is a (self%na,ncb) matrix
677 !> C is a (self%na,ncb) matrix where optionally only the upper or lower
678 !> triangle may be computed
679 !>
680 !> the MPI commicators are already known to the type. Thus the class method "setup" must be called
681 !> BEFORE this method is used
682 !> \details
683 !>
684 !> \param self class(elpa_t), the ELPA object
685 !> \param uplo_a 'U' if A is upper triangular
686 !> 'L' if A is lower triangular
687 !> anything else if A is a full matrix
688 !> Please note: This pertains to the original A (as set in the calling program)
689 !> whereas the transpose of A is used for calculations
690 !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
691 !> i.e. it may contain arbitrary numbers
692 !> \param uplo_c 'U' if only the upper diagonal part of C is needed
693 !> 'L' if only the upper diagonal part of C is needed
694 !> anything else if the full matrix C is needed
695 !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
696 !> written to a certain extent, i.e. one shouldn't rely on the content there!
697 !> \param ncb Number of columns of global matrices B and C
698 !> \param a matrix a
699 !> \param self%local_nrows number of rows of local (sub) matrix a, set with method set("local_nrows,value")
700 !> \param self%local_ncols number of columns of local (sub) matrix a, set with method set("local_ncols,value")
701 !> \param b matrix b
702 !> \param nrows_b number of rows of local (sub) matrix b
703 !> \param ncols_b number of columns of local (sub) matrix b
704 !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
705 !> \param c matrix c
706 !> \param nrows_c number of rows of local (sub) matrix c
707 !> \param ncols_c number of columns of local (sub) matrix c
708 !> \param error optional argument, error code which can be queried with elpa_strerr
709 abstract interface
710 subroutine elpa_hermitian_multiply_a_h_a_&
711 &elpa_impl_suffix&
712 &_i(self,uplo_a, uplo_c, ncb, a, b, nrows_b, ncols_b, &
713 c, nrows_c, ncols_c, error)
714 use, intrinsic :: iso_c_binding
715 import elpa_t
716 implicit none
717 class(elpa_t) :: self
718 character*1 :: uplo_a, uplo_c
719 integer(kind=c_int), intent(in) :: nrows_b, ncols_b, nrows_c, ncols_c, ncb
720#ifdef USE_ASSUMED_SIZE
721 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,*), b(nrows_b,*), c(nrows_c,*)
722#else
723 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,self%local_ncols), b(nrows_b,ncols_b), c(nrows_c,ncols_c)
724#endif
725
726#ifdef USE_FORTRAN2008
727 integer, optional :: error
728#else
729 integer :: error
730#endif
731 end subroutine
732 end interface
733
734
735 !> \brief abstract definition of interface to compute C : = A**T * B
736 !> where A is a square matrix (self%a,self%na) which is optionally upper or lower triangular
737 !> B is a (self%na,ncb) matrix
738 !> C is a (self%na,ncb) matrix where optionally only the upper or lower
739 !> triangle may be computed
740 !>
741 !> the MPI commicators are already known to the type. Thus the class method "setup" must be called
742 !> BEFORE this method is used
743 !> \details
744 !>
745 !> \param self class(elpa_t), the ELPA object
746 !> \param uplo_a 'U' if A is upper triangular
747 !> 'L' if A is lower triangular
748 !> anything else if A is a full matrix
749 !> Please note: This pertains to the original A (as set in the calling program)
750 !> whereas the transpose of A is used for calculations
751 !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
752 !> i.e. it may contain arbitrary numbers
753 !> \param uplo_c 'U' if only the upper diagonal part of C is needed
754 !> 'L' if only the upper diagonal part of C is needed
755 !> anything else if the full matrix C is needed
756 !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
757 !> written to a certain extent, i.e. one shouldn't rely on the content there!
758 !> \param ncb Number of columns of global matrices B and C
759 !> \param a matrix a, as device pointer of type(c_ptr)
760 !> \param self%local_nrows number of rows of local (sub) matrix a, set with method set("local_nrows,value")
761 !> \param self%local_ncols number of columns of local (sub) matrix a, set with method set("local_ncols,value")
762 !> \param b matrix b, as device pointer of type(c_ptr)
763 !> \param nrows_b number of rows of local (sub) matrix b
764 !> \param ncols_b number of columns of local (sub) matrix b
765 !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
766 !> \param c matrix c, as device pointer of type(c_ptr)
767 !> \param nrows_c number of rows of local (sub) matrix c
768 !> \param ncols_c number of columns of local (sub) matrix c
769 !> \param error optional argument, error code which can be queried with elpa_strerr
770 abstract interface
771 subroutine elpa_hermitian_multiply_d_ptr_&
772 &elpa_impl_suffix&
773 &_i(self,uplo_a, uplo_c, ncb, a, b, nrows_b, ncols_b, &
774 c, nrows_c, ncols_c, error)
775 use, intrinsic :: iso_c_binding
776 import elpa_t
777 implicit none
778 class(elpa_t) :: self
779 character*1 :: uplo_a, uplo_c
780 integer(kind=c_int), intent(in) :: nrows_b, ncols_b, nrows_c, ncols_c, ncb
781 type(c_ptr) :: a, b, c
782!#ifdef USE_ASSUMED_SIZE
783! MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows,*), b(nrows_b,*), c(nrows_c,*)
784!#else
785! MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows,self%local_ncols), b(nrows_b,ncols_b), c(nrows_c,ncols_c)
786!#endif
787
788#ifdef USE_FORTRAN2008
789 integer, optional :: error
790#else
791 integer :: error
792#endif
793 end subroutine
794 end interface
795
796! _________________________________________________________________________________________________________________________________
797 ! PETERDEBUG: fix description; add to ELPA docs
798 !> \brief abstract definition of interface to compute C : = A**T * B
799 !> where A is a square matrix (self%a,self%na) which is optionally upper or lower triangular
800 !> B is a (self%na,ncb) matrix
801 !> C is a (self%na,ncb) matrix where optionally only the upper or lower
802 !> triangle may be computed
803 !>
804 !> the MPI commicators are already known to the type. Thus the class method "setup" must be called
805 !> BEFORE this method is used
806 !> \details
807 !>
808 !> \param self class(elpa_t), the ELPA object
809 !> \param trans_a 'U' if A is upper triangular ! PETERDEBUG
810 !> 'L' if A is lower triangular
811 !> anything else if A is a full matrix
812 !> Please note: This pertains to the original A (as set in the calling program)
813 !> whereas the transpose of A is used for calculations
814 !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
815 !> i.e. it may contain arbitrary numbers
816 !> \param trans_b 'U' if only the upper diagonal part of C is needed
817 !> 'L' if only the upper diagonal part of C is needed
818 !> anything else if the full matrix C is needed
819 !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
820 !> written to a certain extent, i.e. one shouldn't rely on the content there!
821 !> \param ncb Number of columns of global matrices B and C
822 !> \param a matrix a
823 !> \param self%local_nrows number of rows of local (sub) matrix a, set with method set("local_nrows,value")
824 !> \param self%local_ncols number of columns of local (sub) matrix a, set with method set("local_ncols,value")
825 !> \param b matrix b
826 !> \param nrows_b number of rows of local (sub) matrix b
827 !> \param ncols_b number of columns of local (sub) matrix b
828 !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
829 !> \param c matrix c
830 !> \param nrows_c number of rows of local (sub) matrix c
831 !> \param ncols_c number of columns of local (sub) matrix c
832 !> \param error optional argument, error code which can be queried with elpa_strerr
833 abstract interface
834 subroutine elpa_pxgemm_multiply_a_h_a_&
835 &elpa_impl_suffix&
836 &_i(self, trans_a, trans_b, ncb, a, b, nrows_b, ncols_b, &
837 c, nrows_c, ncols_c, error)
838 use, intrinsic :: iso_c_binding
839 import elpa_t
840 implicit none
841 class(elpa_t) :: self
842 character*1 :: trans_a, trans_b
843 integer(kind=c_int), intent(in) :: nrows_b, ncols_b, nrows_c, ncols_c, ncb
844#ifdef USE_ASSUMED_SIZE
845 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,*), b(nrows_b,*), c(nrows_c,*)
846#else
847 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,self%local_ncols), b(nrows_b,ncols_b), c(nrows_c,ncols_c)
848#endif
849
850#ifdef USE_FORTRAN2008
851 integer, optional :: error
852#else
853 integer :: error
854#endif
855 end subroutine
856 end interface
857
858
859 !> \brief abstract definition of interface to compute C : = A**T * B
860 !> where A is a square matrix (self%a,self%na) which is optionally upper or lower triangular
861 !> B is a (self%na,ncb) matrix
862 !> C is a (self%na,ncb) matrix where optionally only the upper or lower
863 !> triangle may be computed
864 !>
865 !> the MPI commicators are already known to the type. Thus the class method "setup" must be called
866 !> BEFORE this method is used
867 !> \details
868 !>
869 !> \param self class(elpa_t), the ELPA object
870 !> \param trans_a 'U' if A is upper triangular ! PETERDEBUG
871 !> 'L' if A is lower triangular
872 !> anything else if A is a full matrix
873 !> Please note: This pertains to the original A (as set in the calling program)
874 !> whereas the transpose of A is used for calculations
875 !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
876 !> i.e. it may contain arbitrary numbers
877 !> \param trans_b 'U' if only the upper diagonal part of C is needed
878 !> 'L' if only the upper diagonal part of C is needed
879 !> anything else if the full matrix C is needed
880 !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
881 !> written to a certain extent, i.e. one shouldn't rely on the content there!
882 !> \param ncb Number of columns of global matrices B and C
883 !> \param a matrix a, as device pointer of type(c_ptr)
884 !> \param self%local_nrows number of rows of local (sub) matrix a, set with method set("local_nrows,value")
885 !> \param self%local_ncols number of columns of local (sub) matrix a, set with method set("local_ncols,value")
886 !> \param b matrix b, as device pointer of type(c_ptr)
887 !> \param nrows_b number of rows of local (sub) matrix b
888 !> \param ncols_b number of columns of local (sub) matrix b
889 !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
890 !> \param c matrix c, as device pointer of type(c_ptr)
891 !> \param nrows_c number of rows of local (sub) matrix c
892 !> \param ncols_c number of columns of local (sub) matrix c
893 !> \param error optional argument, error code which can be queried with elpa_strerr
894 abstract interface
895 subroutine elpa_pxgemm_multiply_d_ptr_&
896 &elpa_impl_suffix&
897 &_i(self, trans_a, trans_b, ncb, a, b, nrows_b, ncols_b, &
898 c, nrows_c, ncols_c, error)
899 use, intrinsic :: iso_c_binding
900 import elpa_t
901 implicit none
902 class(elpa_t) :: self
903 character*1 :: trans_a, trans_b
904 integer(kind=c_int), intent(in) :: nrows_b, ncols_b, nrows_c, ncols_c, ncb
905 type(c_ptr) :: a, b, c
906!#ifdef USE_ASSUMED_SIZE
907! MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows,*), b(nrows_b,*), c(nrows_c,*)
908!#else
909! MATH_DATATYPE(kind=C_DATATYPE_KIND) :: a(self%local_nrows,self%local_ncols), b(nrows_b,ncols_b), c(nrows_c,ncols_c)
910!#endif
911
912#ifdef USE_FORTRAN2008
913 integer, optional :: error
914#else
915 integer :: error
916#endif
917 end subroutine
918 end interface
919
920! _________________________________________________________________________________________________________________________________
921
922 !> \brief abstract definition of interface to do a cholesky decomposition of a matrix
923 !>
924 !> The dimensions of the matrix a (locally distributed and global), the block-cylic-distribution
925 !> block size, and the MPI communicators are already known to the object and MUST be set BEFORE
926 !> with the class method "setup"
927 !>
928 !> Parameters
929 !> \param self class(elpa_t), the ELPA object
930#if ELPA_IMPL_SUFFIX == d
931 !> \param a double real matrix: the matrix to be decomposed
932#endif
933#if ELPA_IMPL_SUFFIX == f
934 !> \param a single real matrix: the matrix to be decomposed
935#endif
936#if ELPA_IMPL_SUFFIX == dc
937 !> \param a double complex matrix: the matrix to be decomposed
938#endif
939#if ELPA_IMPL_SUFFIX == fc
940 !> \param a single complex matrix: the matrix to be decomposed
941#endif
942 !> \param error integer, optional : error code, which can be queried with elpa_strerr
943 abstract interface
944 subroutine elpa_cholesky_a_h_a_&
945 &elpa_impl_suffix&
946 &_i(self, a, error)
947 use, intrinsic :: iso_c_binding
948 import elpa_t
949 implicit none
950 class(elpa_t) :: self
951#ifdef USE_ASSUMED_SIZE
952 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,*)
953#else
954 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,self%local_ncols)
955#endif
956
957#ifdef USE_FORTRAN2008
958 integer, optional :: error
959#else
960 integer :: error
961#endif
962 end subroutine
963 end interface
964
965
966 !> \brief abstract definition of interface to do a cholesky decomposition of a matrix
967 !>
968 !> The dimensions of the matrix a (locally distributed and global), the block-cylic-distribution
969 !> block size, and the MPI communicators are already known to the object and MUST be set BEFORE
970 !> with the class method "setup"
971 !>
972 !> Parameters
973 !> \param self class(elpa_t), the ELPA object
974#if ELPA_IMPL_SUFFIX == d
975 !> \param a double real matrix: the matrix to be decomposed as type(c_ptr) device pointer
976#endif
977#if ELPA_IMPL_SUFFIX == f
978 !> \param a single real matrix: the matrix to be decomposed as type(c_ptr) device pointer
979#endif
980#if ELPA_IMPL_SUFFIX == dc
981 !> \param a double complex matrix: the matrix to be decomposed as type(c_ptr) device pointer
982#endif
983#if ELPA_IMPL_SUFFIX == fc
984 !> \param a single complex matrix: the matrix to be decomposed as type(c_ptr) device pointer
985#endif
986 !> \param error integer, optional : error code, which can be queried with elpa_strerr
987 abstract interface
988 subroutine elpa_cholesky_d_ptr_&
989 &elpa_impl_suffix&
990 &_i(self, a, error)
991 use, intrinsic :: iso_c_binding
992 import elpa_t
993 implicit none
994 class(elpa_t) :: self
995 type(c_ptr) :: a
996
997#ifdef USE_FORTRAN2008
998 integer, optional :: error
999#else
1000 integer :: error
1001#endif
1002 end subroutine
1003 end interface
1004
1005
1006
1007 !> \brief abstract definition of interface to invert a triangular matrix
1008 !>
1009 !> The dimensions of the matrix a (locally distributed and global), the block-cylic-distribution
1010 !> block size, and the MPI communicators are already known to the object and MUST be set BEFORE
1011 !> with the class method "setup"
1012 !>
1013 !> Parameters
1014 !> \param self class(elpa_t), the ELPA object
1015#if ELPA_IMPL_SUFFIX == d
1016 !> \param a double real matrix: the matrix to be inverted
1017#endif
1018#if ELPA_IMPL_SUFFIX == f
1019 !> \param a single real matrix: the matrix to be inverted
1020#endif
1021#if ELPA_IMPL_SUFFIX == dc
1022 !> \param a double complex matrix: the matrix to be inverted
1023#endif
1024#if ELPA_IMPL_SUFFIX == fc
1025 !> \param a single complex matrix: the matrix to be inverted
1026#endif
1027
1028 !> \param error integer, optional : error code, which can be queried with elpa_strerr
1029 abstract interface
1030 subroutine elpa_invert_trm_a_h_a_&
1031 &elpa_impl_suffix&
1032 &_i(self, a, error)
1033 use, intrinsic :: iso_c_binding
1034 import elpa_t
1035 implicit none
1036 class(elpa_t) :: self
1037#ifdef USE_ASSUMED_SIZE
1038 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,*)
1039#else
1040 math_datatype(kind=c_datatype_kind) :: a(self%local_nrows,self%local_ncols)
1041#endif
1042
1043#ifdef USE_FORTRAN2008
1044 integer, optional :: error
1045#else
1046 integer :: error
1047#endif
1048 end subroutine
1049 end interface
1050
1051 !> \brief abstract definition of interface to invert a triangular matrix using device pointer
1052 !>
1053 !> The dimensions of the matrix a (locally distributed and global), the block-cylic-distribution
1054 !> block size, and the MPI communicators are already known to the object and MUST be set BEFORE
1055 !> with the class method "setup"
1056 !>
1057 !> Parameters
1058 !> \param self class(elpa_t), the ELPA object
1059#if ELPA_IMPL_SUFFIX == d
1060 !> \param a double real matrix: the matrix to be inverted as device pointer type(c_ptr)
1061#endif
1062#if ELPA_IMPL_SUFFIX == f
1063 !> \param a single real matrix: the matrix to be inverted as device pointer type(c_ptr)
1064#endif
1065#if ELPA_IMPL_SUFFIX == dc
1066 !> \param a double complex matrix: the matrix to be inverted as device pointer type(c_ptr)
1067#endif
1068#if ELPA_IMPL_SUFFIX == fc
1069 !> \param a single complex matrix: the matrix to be inverted as device pointer type(c_ptr)
1070#endif
1071
1072 !> \param error integer, optional : error code, which can be queried with elpa_strerr
1073 abstract interface
1074 subroutine elpa_invert_trm_d_ptr_&
1075 &elpa_impl_suffix&
1076 &_i(self, a, error)
1077 use, intrinsic :: iso_c_binding
1078 import elpa_t
1079 implicit none
1080 class(elpa_t) :: self
1081 type(c_ptr) :: a
1082
1083#ifdef USE_FORTRAN2008
1084 integer, optional :: error
1085#else
1086 integer :: error
1087#endif
1088 end subroutine
1089 end interface
1090
1091
1092
1093 !> \brief abstract definition of interface to solve the eigenvalue problem for a valued tridiangular matrix
1094 !>
1095 !> The dimensions of the matrix a (locally distributed and global), the block-cylic-distribution
1096 !> block size, and the MPI communicators are already known to the object and MUST be set BEFORE
1097 !> with the class method "setup"
1098 !>
1099 !> Parameters
1100 !> \param self class(elpa_t), the ELPA object
1101#if ELPA_IMPL_SUFFIX == d
1102 !> \param d double real 1d array: the diagonal elements of a matrix defined in setup, on output the eigenvalues
1103 !> in ascending order
1104 !> \param e double real 1d array: the subdiagonal elements of a matrix defined in setup
1105 !> \param q double real matrix: on output contains the eigenvectors
1106#endif
1107#if ELPA_IMPL_SUFFIX == f
1108 !> \param d single real 1d array: the diagonal elements of a matrix defined in setup, on output the eigenvalues
1109 !> in ascending order
1110 !> \param e single real 1d array: the subdiagonal elements of a matrix defined in setup
1111 !> \param q single real matrix: on output contains the eigenvectors
1112#endif
1113 !> \param error integer, optional : error code, which can be queried with elpa_strerr
1114 abstract interface
1115 subroutine elpa_solve_tridiagonal_&
1116 &elpa_impl_suffix&
1117 &_i(self, d, e, q, error)
1118 use, intrinsic :: iso_c_binding
1119 import elpa_t
1120 implicit none
1121 class(elpa_t) :: self
1122 real(kind=c_real_datatype) :: d(self%na), e(self%na)
1123#ifdef USE_ASSUMED_SIZE
1124 real(kind=c_real_datatype) :: q(self%local_nrows,*)
1125#else
1126 real(kind=c_real_datatype) :: q(self%local_nrows,self%local_ncols)
1127#endif
1128
1129#ifdef USE_FORTRAN2008
1130 integer, optional :: error
1131#else
1132 integer :: error
1133#endif
1134 end subroutine
1135 end interface
1136
struct elpa_struct * elpa_t
Definition elpa.h:10