Line data Source code
1 : ! This file is part of ELPA.
2 : !
3 : ! The ELPA library was originally created by the ELPA consortium,
4 : ! consisting of the following organizations:
5 : !
6 : ! - Max Planck Computing and Data Facility (MPCDF), formerly known as
7 : ! Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
8 : ! - Bergische Universität Wuppertal, Lehrstuhl für angewandte
9 : ! Informatik,
10 : ! - Technische Universität München, Lehrstuhl für Informatik mit
11 : ! Schwerpunkt Wissenschaftliches Rechnen ,
12 : ! - Fritz-Haber-Institut, Berlin, Abt. Theorie,
13 : ! - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
14 : ! Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
15 : ! and
16 : ! - IBM Deutschland GmbH
17 : !
18 : ! This particular source code file contains additions, changes and
19 : ! enhancements authored by Intel Corporation which is not part of
20 : ! the ELPA consortium.
21 : !
22 : ! More information can be found here:
23 : ! http://elpa.mpcdf.mpg.de/
24 : !
25 : ! ELPA is free software: you can redistribute it and/or modify
26 : ! it under the terms of the version 3 of the license of the
27 : ! GNU Lesser General Public License as published by the Free
28 : ! Software Foundation.
29 : !
30 : ! ELPA is distributed in the hope that it will be useful,
31 : ! but WITHOUT ANY WARRANTY; without even the implied warranty of
32 : ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 : ! GNU Lesser General Public License for more details.
34 : !
35 : ! You should have received a copy of the GNU Lesser General Public License
36 : ! along with ELPA. If not, see <http://www.gnu.org/licenses/>
37 : !
38 : ! ELPA reflects a substantial effort on the part of the original
39 : ! ELPA consortium, and we ask you to respect the spirit of the
40 : ! license that we chose: i.e., please contribute any changes you
41 : ! may have back to the original ELPA library distribution, and keep
42 : ! any derivatives of ELPA under the same license that we chose for
43 : ! the original distribution, the GNU Lesser General Public License.
44 : !
45 : !
46 : ! ELPA1 -- Faster replacements for ScaLAPACK symmetric eigenvalue routines
47 : !
48 : ! Copyright of the original code rests with the authors inside the ELPA
49 : ! consortium. The copyright of any additional modifications shall rest
50 : ! with their original authors, but shall adhere to the licensing terms
51 : ! distributed along with the original code in the file "COPYING".
52 : !
53 : ! This file has been rewritten by A. Marek, MPCDF
54 : #include "config-f90.h"
55 :
56 : !> \brief Fortran module which provides helper routines for matrix calculations
57 : module ELPA1_AUXILIARY
58 : use elpa_utilities
59 :
60 : implicit none
61 :
62 : public :: elpa_mult_at_b_real_double !< Multiply double-precision real matrices A**T * B
63 : public :: mult_at_b_real !< Old, deprecated interface to multiply double-precision real matrices A**T * B. DO NOT USE
64 :
65 : public :: elpa_mult_ah_b_complex_double !< Multiply double-precision complex matrices A**H * B
66 : public :: mult_ah_b_complex !< Old, deprecated interface to multiply double-precision complex matrices A**H * B. DO NOT USE
67 :
68 : public :: elpa_invert_trm_real_double !< Invert double-precision real triangular matrix
69 : public :: invert_trm_real !< Old, deprecated interface for inversion of double-precision real triangular matrix. DO NOT USE
70 :
71 : public :: elpa_invert_trm_complex_double !< Invert double-precision complex triangular matrix
72 : public :: invert_trm_complex !< Old, deprecated interface to invert double-precision complex triangular matrix. DO NOT USE
73 :
74 : public :: elpa_cholesky_real_double !< Cholesky factorization of a double-precision real matrix
75 : public :: cholesky_real !< Old, deprecated name for Cholesky factorization of a double-precision real matrix. DO NOT USE
76 :
77 : public :: elpa_cholesky_complex_double !< Cholesky factorization of a double-precision complex matrix
78 : public :: cholesky_complex !< Old, deprecated interface for a Cholesky factorization of a double-precision complex matrix. DO NOT USE
79 :
80 : public :: elpa_solve_tridi_double !< Solve tridiagonal eigensystem for a double-precision matrix with divide and conquer method
81 : public :: solve_tridi !< Old, deprecated interface to solve tridiagonal eigensystem for a double-precision matrix with divide and conquer method
82 :
83 : #ifdef WANT_SINGLE_PRECISION_REAL
84 : public :: elpa_cholesky_real_single !< Cholesky factorization of a single-precision real matrix
85 : public :: elpa_invert_trm_real_single !< Invert single-precision real triangular matrix
86 : public :: elpa_mult_at_b_real_single !< Multiply single-precision real matrices A**T * B
87 : public :: elpa_solve_tridi_single !< Solve tridiagonal eigensystem for a single-precision matrix with divide and conquer method
88 : #endif
89 :
90 : #ifdef WANT_SINGLE_PRECISION_COMPLEX
91 : public :: elpa_cholesky_complex_single !< Cholesky factorization of a single-precision complex matrix
92 : public :: elpa_invert_trm_complex_single !< Invert single-precision complex triangular matrix
93 : public :: elpa_mult_ah_b_complex_single !< Multiply single-precision complex matrices A**H * B
94 : #endif
95 :
96 : !> \brief cholesky_real: old, deprecated interface for Cholesky factorization of a double-precision real symmetric matrix
97 : !> \details
98 : !>
99 : !> \param na Order of matrix
100 : !> \param a(lda,matrixCols) Distributed matrix which should be factorized.
101 : !> Distribution is like in Scalapack.
102 : !> Only upper triangle needs to be set.
103 : !> On return, the upper triangle contains the Cholesky factor
104 : !> and the lower triangle is set to 0.
105 : !> \param lda Leading dimension of a
106 : !> \param matrixCols local columns of matrix a
107 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
108 : !> \param mpi_comm_rows MPI communicator for rows
109 : !> \param mpi_comm_cols MPI communicator for columns
110 : !> \param wantDebug logical, more debug information on failure
111 : !> \result succes logical, reports success or failure
112 : interface cholesky_real
113 : module procedure elpa_cholesky_real_double
114 : end interface
115 :
116 : !> \brief Old, deprecated interface invert_trm_real: Inverts a upper double-precision triangular matrix
117 : !> \details
118 : !> \param na Order of matrix
119 : !> \param a(lda,matrixCols) Distributed matrix which should be inverted
120 : !> Distribution is like in Scalapack.
121 : !> Only upper triangle needs to be set.
122 : !> The lower triangle is not referenced.
123 : !> \param lda Leading dimension of a
124 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
125 : !> \param matrixCols local columns of matrix a
126 : !> \param mpi_comm_rows MPI communicator for rows
127 : !> \param mpi_comm_cols MPI communicator for columns
128 : !> \param wantDebug logical, more debug information on failure
129 : !> \param result logical, reports success or failure
130 :
131 : interface invert_trm_real
132 : module procedure elpa_invert_trm_real_double
133 : end interface
134 :
135 : !> \brief old, deprecated interface cholesky_complex: Cholesky factorization of a double-precision complex hermitian matrix
136 : !> \details
137 : !> \param na Order of matrix
138 : !> \param a(lda,matrixCols) Distributed matrix which should be factorized.
139 : !> Distribution is like in Scalapack.
140 : !> Only upper triangle needs to be set.
141 : !> On return, the upper triangle contains the Cholesky factor
142 : !> and the lower triangle is set to 0.
143 : !> \param lda Leading dimension of a
144 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
145 : !> \param matrixCols local columns of matrix a
146 : !> \param mpi_comm_rows MPI communicator for rows
147 : !> \param mpi_comm_cols MPI communicator for columns
148 : !> \param wantDebug logical, more debug information on failure
149 : !> \result succes logical, reports success or failure
150 :
151 :
152 : interface cholesky_complex
153 : module procedure elpa_cholesky_complex_double
154 : end interface
155 :
156 : !> \brief old, deprecated interface invert_trm_complex: Inverts a double-precision complex upper triangular matrix
157 : !> \details
158 : !> \param na Order of matrix
159 : !> \param a(lda,matrixCols) Distributed matrix which should be inverted
160 : !> Distribution is like in Scalapack.
161 : !> Only upper triangle needs to be set.
162 : !> The lower triangle is not referenced.
163 : !> \param lda Leading dimension of a
164 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
165 : !> \param matrixCols local columns of matrix a
166 : !> \param mpi_comm_rows MPI communicator for rows
167 : !> \param mpi_comm_cols MPI communicator for columns
168 : !> \param wantDebug logical, more debug information on failure
169 : !> \result succes logical, reports success or failure
170 :
171 : interface invert_trm_complex
172 : module procedure elpa_invert_trm_complex_double
173 : end interface
174 :
175 : !> \brief mult_at_b_real: Performs C : = A**T * B for double matrices
176 : !> this is the old, deprecated interface for the newer elpa_mult_at_b_real
177 : !> where A is a square matrix (na,na) which is optionally upper or lower triangular
178 : !> B is a (na,ncb) matrix
179 : !> C is a (na,ncb) matrix where optionally only the upper or lower
180 : !> triangle may be computed
181 : !> \details
182 :
183 : !> \param uplo_a 'U' if A is upper triangular
184 : !> 'L' if A is lower triangular
185 : !> anything else if A is a full matrix
186 : !> Please note: This pertains to the original A (as set in the calling program)
187 : !> whereas the transpose of A is used for calculations
188 : !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
189 : !> i.e. it may contain arbitrary numbers
190 : !> \param uplo_c 'U' if only the upper diagonal part of C is needed
191 : !> 'L' if only the upper diagonal part of C is needed
192 : !> anything else if the full matrix C is needed
193 : !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
194 : !> written to a certain extent, i.e. one shouldn't rely on the content there!
195 : !> \param na Number of rows/columns of A, number of rows of B and C
196 : !> \param ncb Number of columns of B and C
197 : !> \param a matrix a
198 : !> \param lda leading dimension of matrix a
199 : !> \param b matrix b
200 : !> \param ldb leading dimension of matrix b
201 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
202 : !> \param mpi_comm_rows MPI communicator for rows
203 : !> \param mpi_comm_cols MPI communicator for columns
204 : !> \param c matrix c
205 : !> \param ldc leading dimension of matrix c
206 : interface mult_at_b_real
207 : module procedure elpa_mult_at_b_real_double
208 : end interface
209 :
210 : !> \brief Old, deprecated interface mult_ah_b_complex: Performs C : = A**H * B for double-precision matrices
211 : !> where A is a square matrix (na,na) which is optionally upper or lower triangular
212 : !> B is a (na,ncb) matrix
213 : !> C is a (na,ncb) matrix where optionally only the upper or lower
214 : !> triangle may be computed
215 : !> \details
216 : !>
217 : !> \param uplo_a 'U' if A is upper triangular
218 : !> 'L' if A is lower triangular
219 : !> anything else if A is a full matrix
220 : !> Please note: This pertains to the original A (as set in the calling program)
221 : !> whereas the transpose of A is used for calculations
222 : !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
223 : !> i.e. it may contain arbitrary numbers
224 : !> \param uplo_c 'U' if only the upper diagonal part of C is needed
225 : !> 'L' if only the upper diagonal part of C is needed
226 : !> anything else if the full matrix C is needed
227 : !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
228 : !> written to a certain extent, i.e. one shouldn't rely on the content there!
229 : !> \param na Number of rows/columns of A, number of rows of B and C
230 : !> \param ncb Number of columns of B and C
231 : !> \param a matrix a
232 : !> \param lda leading dimension of matrix a
233 : !> \param b matrix b
234 : !> \param ldb leading dimension of matrix b
235 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
236 : !> \param mpi_comm_rows MPI communicator for rows
237 : !> \param mpi_comm_cols MPI communicator for columns
238 : !> \param c matrix c
239 : !> \param ldc leading dimension of matrix c
240 : interface mult_ah_b_complex
241 : module procedure elpa_mult_ah_b_complex_double
242 : end interface
243 :
244 :
245 : !> \brief solve_tridi: Old, deprecated interface to solve a double-precision tridiagonal eigensystem for a double-precision matrix with divide and conquer method
246 : !> \details
247 : !>
248 : !> \param na Matrix dimension
249 : !> \param nev number of eigenvalues/vectors to be computed
250 : !> \param d array d(na) on input diagonal elements of tridiagonal matrix, on
251 : !> output the eigenvalues in ascending order
252 : !> \param e array e(na) on input subdiagonal elements of matrix, on exit destroyed
253 : !> \param q on exit : matrix q(ldq,matrixCols) contains the eigenvectors
254 : !> \param ldq leading dimension of matrix q
255 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
256 : !> \param matrixCols columns of matrix q
257 : !> \param mpi_comm_rows MPI communicator for rows
258 : !> \param mpi_comm_cols MPI communicator for columns
259 : !> \param wantDebug logical, give more debug information if .true.
260 : !> \result success logical, .true. on success, else .false.
261 : interface solve_tridi
262 : module procedure elpa_solve_tridi_double
263 : end interface
264 :
265 : contains
266 :
267 : !> \brief cholesky_real_double: Cholesky factorization of a double-precision real symmetric matrix
268 : !> \details
269 : !>
270 : !> \param na Order of matrix
271 : !> \param a(lda,matrixCols) Distributed matrix which should be factorized.
272 : !> Distribution is like in Scalapack.
273 : !> Only upper triangle needs to be set.
274 : !> On return, the upper triangle contains the Cholesky factor
275 : !> and the lower triangle is set to 0.
276 : !> \param lda Leading dimension of a
277 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
278 : !> \param matrixCols local columns of matrix a
279 : !> \param mpi_comm_rows MPI communicator for rows
280 : !> \param mpi_comm_cols MPI communicator for columns
281 : !> \param wantDebug logical, more debug information on failure
282 : !> \param succes logical, reports success or failure
283 :
284 : #define REALCASE 1
285 : #define DOUBLE_PRECISION
286 : #include "../../general/precision_macros.h"
287 :
288 :
289 768 : function elpa_cholesky_real_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, &
290 : wantDebug) result(success)
291 : #include "./elpa_cholesky_template.F90"
292 768 : end function
293 :
294 : #ifdef WANT_SINGLE_PRECISION_REAL
295 : #define REALCASE 1
296 : #define SINGLE_PRECISION
297 : #include "../../general/precision_macros.h"
298 :
299 : !> \brief cholesky_real_single: Cholesky factorization of a single-precision real symmetric matrix
300 : !> \details
301 : !>
302 : !> \param na Order of matrix
303 : !> \param a(lda,matrixCols) Distributed matrix which should be factorized.
304 : !> Distribution is like in Scalapack.
305 : !> Only upper triangle needs to be set.
306 : !> On return, the upper triangle contains the Cholesky factor
307 : !> and the lower triangle is set to 0.
308 : !> \param lda Leading dimension of a
309 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
310 : !> \param matrixCols local columns of matrix a
311 : !> \param mpi_comm_rows MPI communicator for rows
312 : !> \param mpi_comm_cols MPI communicator for columns
313 : !> \param wantDebug logical, more debug information on failure
314 : !> \param succes logical, reports success or failure
315 :
316 384 : function elpa_cholesky_real_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, &
317 : wantDebug) result(success)
318 : #include "./elpa_cholesky_template.F90"
319 384 : end function
320 :
321 : #endif /* WANT_SINGLE_PRECSION_REAL */
322 :
323 : #define REALCASE 1
324 : #define DOUBLE_PRECISION
325 : #include "../../general/precision_macros.h"
326 : !> \brief elpa_invert_trm_real_double: Inverts a double-precision real upper triangular matrix
327 : !> \details
328 : !> \param na Order of matrix
329 : !> \param a(lda,matrixCols) Distributed matrix which should be inverted
330 : !> Distribution is like in Scalapack.
331 : !> Only upper triangle needs to be set.
332 : !> The lower triangle is not referenced.
333 : !> \param lda Leading dimension of a
334 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
335 : !> \param matrixCols local columns of matrix a
336 : !> \param mpi_comm_rows MPI communicator for rows
337 : !> \param mpi_comm_cols MPI communicator for columns
338 : !> \param wantDebug logical, more debug information on failure
339 : !> \result succes logical, reports success or failure
340 384 : function elpa_invert_trm_real_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
341 : #include "./elpa_invert_trm.F90"
342 384 : end function
343 :
344 : #if WANT_SINGLE_PRECISION_REAL
345 : #define REALCASE 1
346 : #define SINGLE_PRECISION
347 : #include "../../general/precision_macros.h"
348 :
349 : !> \brief elpa_invert_trm_real_single: Inverts a single-precision real upper triangular matrix
350 : !> \details
351 : !> \param na Order of matrix
352 : !> \param a(lda,matrixCols) Distributed matrix which should be inverted
353 : !> Distribution is like in Scalapack.
354 : !> Only upper triangle needs to be set.
355 : !> The lower triangle is not referenced.
356 : !> \param lda Leading dimension of a
357 : !> \param matrixCols local columns of matrix a
358 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
359 : !> \param mpi_comm_rows MPI communicator for rows
360 : !> \param mpi_comm_cols MPI communicator for columns
361 : !> \param wantDebug logical, more debug information on failure
362 : !> \result succes logical, reports success or failure
363 192 : function elpa_invert_trm_real_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
364 : #include "./elpa_invert_trm.F90"
365 192 : end function
366 :
367 : #endif /* WANT_SINGLE_PRECISION_REAL */
368 :
369 :
370 : #define COMPLEXCASE 1
371 : #define DOUBLE_PRECISION
372 : #include "../../general/precision_macros.h"
373 :
374 : !> \brief elpa_cholesky_complex_double: Cholesky factorization of a double-precision complex hermitian matrix
375 : !> \details
376 : !> \param na Order of matrix
377 : !> \param a(lda,matrixCols) Distributed matrix which should be factorized.
378 : !> Distribution is like in Scalapack.
379 : !> Only upper triangle needs to be set.
380 : !> On return, the upper triangle contains the Cholesky factor
381 : !> and the lower triangle is set to 0.
382 : !> \param lda Leading dimension of a
383 : !> \param matrixCols local columns of matrix a
384 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
385 : !> \param mpi_comm_rows MPI communicator for rows
386 : !> \param mpi_comm_cols MPI communicator for columns
387 : !> \param wantDebug logical, more debug information on failure
388 : !> \result succes logical, reports success or failure
389 768 : function elpa_cholesky_complex_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
390 : #include "./elpa_cholesky_template.F90"
391 768 : end function
392 :
393 :
394 : #ifdef WANT_SINGLE_PRECISION_COMPLEX
395 : #define COMPLEXCASE 1
396 : #define SINGLE_PRECISION
397 : #include "../../general/precision_macros.h"
398 :
399 : !> \brief elpa_cholesky_complex_single: Cholesky factorization of a single-precision complex hermitian matrix
400 : !> \details
401 : !> \param na Order of matrix
402 : !> \param a(lda,matrixCols) Distributed matrix which should be factorized.
403 : !> Distribution is like in Scalapack.
404 : !> Only upper triangle needs to be set.
405 : !> On return, the upper triangle contains the Cholesky factor
406 : !> and the lower triangle is set to 0.
407 : !> \param lda Leading dimension of a
408 : !> \param matrixCols local columns of matrix a
409 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
410 : !> \param mpi_comm_rows MPI communicator for rows
411 : !> \param mpi_comm_cols MPI communicator for columns
412 : !> \param wantDebug logical, more debug information on failure
413 : !> \result succes logical, reports success or failure
414 384 : function elpa_cholesky_complex_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
415 : #include "./elpa_cholesky_template.F90"
416 384 : end function
417 :
418 : #endif /* WANT_SINGLE_PRECISION_COMPLEX */
419 :
420 : #define COMPLEXCASE 1
421 : #define DOUBLE_PRECISION
422 : #include "../../general/precision_macros.h"
423 :
424 : !> \brief elpa_invert_trm_complex_double: Inverts a double-precision complex upper triangular matrix
425 : !> \details
426 : !> \param na Order of matrix
427 : !> \param a(lda,matrixCols) Distributed matrix which should be inverted
428 : !> Distribution is like in Scalapack.
429 : !> Only upper triangle needs to be set.
430 : !> The lower triangle is not referenced.
431 : !> \param lda Leading dimension of a
432 : !> \param matrixCols local columns of matrix a
433 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
434 : !> \param mpi_comm_rows MPI communicator for rows
435 : !> \param mpi_comm_cols MPI communicator for columns
436 : !> \param wantDebug logical, more debug information on failure
437 : !> \result succes logical, reports success or failure
438 :
439 384 : function elpa_invert_trm_complex_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
440 : #include "./elpa_invert_trm.F90"
441 384 : end function
442 :
443 : #ifdef WANT_SINGLE_PRECISION_COMPLEX
444 : #define COMPLEXCASE 1
445 : #define SINGLE_PRECISION
446 : #include "../../general/precision_macros.h"
447 :
448 : !> \brief elpa_invert_trm_complex_single: Inverts a single-precision complex upper triangular matrix
449 : !> \details
450 : !> \param na Order of matrix
451 : !> \param a(lda,matrixCols) Distributed matrix which should be inverted
452 : !> Distribution is like in Scalapack.
453 : !> Only upper triangle needs to be set.
454 : !> The lower triangle is not referenced.
455 : !> \param lda Leading dimension of a
456 : !> \param matrixCols local columns of matrix a
457 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
458 : !> \param mpi_comm_rows MPI communicator for rows
459 : !> \param mpi_comm_cols MPI communicator for columns
460 : !> \param wantDebug logical, more debug information on failure
461 : !> \result succes logical, reports success or failure
462 :
463 192 : function elpa_invert_trm_complex_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
464 : #include "./elpa_invert_trm.F90"
465 192 : end function
466 :
467 : #endif /* WANT_SINGE_PRECISION_COMPLEX */
468 :
469 : #define REALCASE 1
470 : #define DOUBLE_PRECISION
471 : #include "../../general/precision_macros.h"
472 : !> \brief mult_at_b_real_double: Performs C : = A**T * B
473 : !> where A is a square matrix (na,na) which is optionally upper or lower triangular
474 : !> B is a (na,ncb) matrix
475 : !> C is a (na,ncb) matrix where optionally only the upper or lower
476 : !> triangle may be computed
477 : !> \details
478 :
479 : !> \param uplo_a 'U' if A is upper triangular
480 : !> 'L' if A is lower triangular
481 : !> anything else if A is a full matrix
482 : !> Please note: This pertains to the original A (as set in the calling program)
483 : !> whereas the transpose of A is used for calculations
484 : !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
485 : !> i.e. it may contain arbitrary numbers
486 : !> \param uplo_c 'U' if only the upper diagonal part of C is needed
487 : !> 'L' if only the upper diagonal part of C is needed
488 : !> anything else if the full matrix C is needed
489 : !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
490 : !> written to a certain extent, i.e. one shouldn't rely on the content there!
491 : !> \param na Number of rows/columns of A, number of rows of B and C
492 : !> \param ncb Number of columns of B and C
493 : !> \param a matrix a
494 : !> \param lda leading dimension of matrix a
495 : !> \param b matrix b
496 : !> \param ldb leading dimension of matrix b
497 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
498 : !> \param mpi_comm_rows MPI communicator for rows
499 : !> \param mpi_comm_cols MPI communicator for columns
500 : !> \param c matrix c
501 : !> \param ldc leading dimension of matrix c
502 : !> \result success
503 :
504 384 : function elpa_mult_at_b_real_double(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, nblk, &
505 384 : mpi_comm_rows, mpi_comm_cols, c, ldc, ldcCols) result(success)
506 : #include "./elpa_multiply_a_b.F90"
507 384 : end function elpa_mult_at_b_real_double
508 :
509 : #if WANT_SINGLE_PRECISION_REAL
510 : #define REALCASE 1
511 : #define SINGLE_PRECISION
512 : #include "../../general/precision_macros.h"
513 :
514 : !> \brief elpa_mult_at_b_real_single: Performs C : = A**T * B
515 : !> where A is a square matrix (na,na) which is optionally upper or lower triangular
516 : !> B is a (na,ncb) matrix
517 : !> C is a (na,ncb) matrix where optionally only the upper or lower
518 : !> triangle may be computed
519 : !> \details
520 :
521 : !> \param uplo_a 'U' if A is upper triangular
522 : !> 'L' if A is lower triangular
523 : !> anything else if A is a full matrix
524 : !> Please note: This pertains to the original A (as set in the calling program)
525 : !> whereas the transpose of A is used for calculations
526 : !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
527 : !> i.e. it may contain arbitrary numbers
528 : !> \param uplo_c 'U' if only the upper diagonal part of C is needed
529 : !> 'L' if only the upper diagonal part of C is needed
530 : !> anything else if the full matrix C is needed
531 : !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
532 : !> written to a certain extent, i.e. one shouldn't rely on the content there!
533 : !> \param na Number of rows/columns of A, number of rows of B and C
534 : !> \param ncb Number of columns of B and C
535 : !> \param a matrix a
536 : !> \param lda leading dimension of matrix a
537 : !> \param b matrix b
538 : !> \param ldb leading dimension of matrix b
539 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
540 : !> \param mpi_comm_rows MPI communicator for rows
541 : !> \param mpi_comm_cols MPI communicator for columns
542 : !> \param c matrix c
543 : !> \param ldc leading dimension of matrix c
544 : !> \result success
545 :
546 192 : function elpa_mult_at_b_real_single(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, nblk, &
547 192 : mpi_comm_rows, mpi_comm_cols, c, ldc, ldcCols) result(success)
548 :
549 : #include "./elpa_multiply_a_b.F90"
550 :
551 192 : end function elpa_mult_at_b_real_single
552 :
553 : #endif /* WANT_SINGLE_PRECISION_REAL */
554 :
555 :
556 : #define COMPLEXCASE 1
557 : #define DOUBLE_PRECISION
558 : #include "../../general/precision_macros.h"
559 :
560 : !> \brief elpa_mult_ah_b_complex_double: Performs C : = A**H * B
561 : !> where A is a square matrix (na,na) which is optionally upper or lower triangular
562 : !> B is a (na,ncb) matrix
563 : !> C is a (na,ncb) matrix where optionally only the upper or lower
564 : !> triangle may be computed
565 : !> \details
566 : !>
567 : !> \param uplo_a 'U' if A is upper triangular
568 : !> 'L' if A is lower triangular
569 : !> anything else if A is a full matrix
570 : !> Please note: This pertains to the original A (as set in the calling program)
571 : !> whereas the transpose of A is used for calculations
572 : !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
573 : !> i.e. it may contain arbitrary numbers
574 : !> \param uplo_c 'U' if only the upper diagonal part of C is needed
575 : !> 'L' if only the upper diagonal part of C is needed
576 : !> anything else if the full matrix C is needed
577 : !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
578 : !> written to a certain extent, i.e. one shouldn't rely on the content there!
579 : !> \param na Number of rows/columns of A, number of rows of B and C
580 : !> \param ncb Number of columns of B and C
581 : !> \param a matrix a
582 : !> \param lda leading dimension of matrix a
583 : !> \param ldaCols columns of matrix a
584 : !> \param b matrix b
585 : !> \param ldb leading dimension of matrix b
586 : !> \param ldbCols columns of matrix b
587 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
588 : !> \param mpi_comm_rows MPI communicator for rows
589 : !> \param mpi_comm_cols MPI communicator for columns
590 : !> \param c matrix c
591 : !> \param ldc leading dimension of matrix c
592 : !> \result success
593 :
594 384 : function elpa_mult_ah_b_complex_double(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, nblk, &
595 384 : mpi_comm_rows, mpi_comm_cols, c, ldc, ldcCols) result(success)
596 : #include "./elpa_multiply_a_b.F90"
597 :
598 384 : end function elpa_mult_ah_b_complex_double
599 :
600 : #ifdef WANT_SINGLE_PRECISION_COMPLEX
601 : #define COMPLEXCASE 1
602 : #define SINGLE_PRECISION
603 : #include "../../general/precision_macros.h"
604 :
605 : !> \brief elpa_mult_ah_b_complex_single: Performs C : = A**H * B
606 : !> where A is a square matrix (na,na) which is optionally upper or lower triangular
607 : !> B is a (na,ncb) matrix
608 : !> C is a (na,ncb) matrix where optionally only the upper or lower
609 : !> triangle may be computed
610 : !> \details
611 : !>
612 : !> \param uplo_a 'U' if A is upper triangular
613 : !> 'L' if A is lower triangular
614 : !> anything else if A is a full matrix
615 : !> Please note: This pertains to the original A (as set in the calling program)
616 : !> whereas the transpose of A is used for calculations
617 : !> If uplo_a is 'U' or 'L', the other triangle is not used at all,
618 : !> i.e. it may contain arbitrary numbers
619 : !> \param uplo_c 'U' if only the upper diagonal part of C is needed
620 : !> 'L' if only the upper diagonal part of C is needed
621 : !> anything else if the full matrix C is needed
622 : !> Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
623 : !> written to a certain extent, i.e. one shouldn't rely on the content there!
624 : !> \param na Number of rows/columns of A, number of rows of B and C
625 : !> \param ncb Number of columns of B and C
626 : !> \param a matrix a
627 : !> \param lda leading dimension of matrix a
628 : !> \param ldaCols columns of matrix a
629 : !> \param b matrix b
630 : !> \param ldb leading dimension of matrix b
631 : !> \param ldbCols columns of matrix b
632 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
633 : !> \param mpi_comm_rows MPI communicator for rows
634 : !> \param mpi_comm_cols MPI communicator for columns
635 : !> \param c matrix c
636 : !> \param ldc leading dimension of matrix c
637 : !> \result success
638 :
639 192 : function elpa_mult_ah_b_complex_single(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, nblk, &
640 192 : mpi_comm_rows, mpi_comm_cols, c, ldc, ldcCols) result(success)
641 :
642 : #include "./elpa_multiply_a_b.F90"
643 :
644 192 : end function elpa_mult_ah_b_complex_single
645 :
646 : #endif /* WANT_SINGLE_PRECISION_COMPLEX */
647 :
648 : #define REALCASE 1
649 : #define DOUBLE_PRECISION
650 : #include "../../general/precision_macros.h"
651 :
652 : !> \brief elpa_solve_tridi_double: Solve tridiagonal eigensystem for a double-precision matrix with divide and conquer method
653 : !> \details
654 : !>
655 : !> \param na Matrix dimension
656 : !> \param nev number of eigenvalues/vectors to be computed
657 : !> \param d array d(na) on input diagonal elements of tridiagonal matrix, on
658 : !> output the eigenvalues in ascending order
659 : !> \param e array e(na) on input subdiagonal elements of matrix, on exit destroyed
660 : !> \param q on exit : matrix q(ldq,matrixCols) contains the eigenvectors
661 : !> \param ldq leading dimension of matrix q
662 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
663 : !> \param matrixCols columns of matrix q
664 : !> \param mpi_comm_rows MPI communicator for rows
665 : !> \param mpi_comm_cols MPI communicator for columns
666 : !> \param wantDebug logical, give more debug information if .true.
667 : !> \result success logical, .true. on success, else .false.
668 :
669 384 : function elpa_solve_tridi_double(na, nev, d, e, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) &
670 : result(success)
671 :
672 : #include "./elpa_solve_tridi.F90"
673 :
674 384 : end function
675 :
676 :
677 : #ifdef WANT_SINGLE_PRECISION_REAL
678 : #define REALCASE 1
679 : #define SINGLE_PRECISION
680 : #include "../../general/precision_macros.h"
681 :
682 : !> \brief elpa_solve_tridi_single: Solve tridiagonal eigensystem for a single-precision matrix with divide and conquer method
683 : !> \details
684 : !>
685 : !> \param na Matrix dimension
686 : !> \param nev number of eigenvalues/vectors to be computed
687 : !> \param d array d(na) on input diagonal elements of tridiagonal matrix, on
688 : !> output the eigenvalues in ascending order
689 : !> \param e array e(na) on input subdiagonal elements of matrix, on exit destroyed
690 : !> \param q on exit : matrix q(ldq,matrixCols) contains the eigenvectors
691 : !> \param ldq leading dimension of matrix q
692 : !> \param nblk blocksize of cyclic distribution, must be the same in both directions!
693 : !> \param matrixCols columns of matrix q
694 : !> \param mpi_comm_rows MPI communicator for rows
695 : !> \param mpi_comm_cols MPI communicator for columns
696 : !> \param wantDebug logical, give more debug information if .true.
697 : !> \result success logical, .true. on success, else .false.
698 :
699 0 : function elpa_solve_tridi_single(na, nev, d, e, q, ldq, nblk, matrixCols, mpi_comm_rows, &
700 : mpi_comm_cols, wantDebug) result(success)
701 :
702 : #include "./elpa_solve_tridi.F90"
703 :
704 0 : end function
705 :
706 : #endif /* WANT_SINGLE_PRECISION_REAL */
707 :
708 :
709 :
710 :
711 : end module elpa1_auxiliary
|