elpa_1stage_c_interface.F90 39.7 KB
Newer Older
Andreas Marek's avatar
Andreas Marek committed
1
2
3
4
5
!    This file is part of ELPA.
!
!    The ELPA library was originally created by the ELPA consortium,
!    consisting of the following organizations:
!
6
7
!    - Max Planck Computing and Data Facility (MPCDF), formerly known as
!      Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
Andreas Marek's avatar
Andreas Marek committed
8
9
10
11
12
!    - Bergische Universität Wuppertal, Lehrstuhl für angewandte
!      Informatik,
!    - Technische Universität München, Lehrstuhl für Informatik mit
!      Schwerpunkt Wissenschaftliches Rechnen ,
!    - Fritz-Haber-Institut, Berlin, Abt. Theorie,
13
!    - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
Andreas Marek's avatar
Andreas Marek committed
14
15
16
17
18
19
!      Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
!      and
!    - IBM Deutschland GmbH
!
!
!    More information can be found here:
20
!    http://elpa.mpcdf.mpg.de/
Andreas Marek's avatar
Andreas Marek committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
!
!    ELPA is free software: you can redistribute it and/or modify
!    it under the terms of the version 3 of the license of the
!    GNU Lesser General Public License as published by the Free
!    Software Foundation.
!
!    ELPA is distributed in the hope that it will be useful,
!    but WITHOUT ANY WARRANTY; without even the implied warranty of
!    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!    GNU Lesser General Public License for more details.
!
!    You should have received a copy of the GNU Lesser General Public License
!    along with ELPA.  If not, see <http://www.gnu.org/licenses/>
!
!    ELPA reflects a substantial effort on the part of the original
!    ELPA consortium, and we ask you to respect the spirit of the
!    license that we chose: i.e., please contribute any changes you
!    may have back to the original ELPA library distribution, and keep
!    any derivatives of ELPA under the same license that we chose for
!    the original distribution, the GNU Lesser General Public License.
!
42
! Author: Andreas Marek, MCPDF
Andreas Marek's avatar
Andreas Marek committed
43
#include "config-f90.h"
44
45
46
47
48
49
50
51
52
53
54
  !lc> #include <complex.h>

  !lc> /*! \brief C old, deprecated interface, will be deleted. Use "elpa_get_communicators"
  !lc> *
  !lc> * \param mpi_comm_word    MPI global communicator (in)
  !lc> * \param my_prow          Row coordinate of the calling process in the process grid (in)
  !lc> * \param my_pcol          Column coordinate of the calling process in the process grid (in)
  !lc> * \param mpi_comm_rows    Communicator for communicating within rows of processes (out)
  !lc> * \result int             integer error value of mpi_comm_split function
  !lc> */
  !lc> int get_elpa_row_col_comms(int mpi_comm_world, int my_prow, int my_pcol, int *mpi_comm_rows, int *mpi_comm_cols);
55
  function get_elpa_row_col_comms_wrapper_c_name1(mpi_comm_world, my_prow, my_pcol, &
Andreas Marek's avatar
Andreas Marek committed
56
                                          mpi_comm_rows, mpi_comm_cols)     &
57
                                          result(mpierr) bind(C,name="get_elpa_row_col_comms")
Andreas Marek's avatar
Andreas Marek committed
58
    use, intrinsic :: iso_c_binding
59
    use elpa1, only : elpa_get_communicators
Andreas Marek's avatar
Andreas Marek committed
60

Andreas Marek's avatar
Andreas Marek committed
61
    implicit none
Andreas Marek's avatar
Andreas Marek committed
62
63
64
65
    integer(kind=c_int)         :: mpierr
    integer(kind=c_int), value  :: mpi_comm_world, my_prow, my_pcol
    integer(kind=c_int)         :: mpi_comm_rows, mpi_comm_cols

66
    mpierr = elpa_get_communicators(mpi_comm_world, my_prow, my_pcol, &
Andreas Marek's avatar
Andreas Marek committed
67
68
69
                                    mpi_comm_rows, mpi_comm_cols)

  end function
70
71
72
73
74
75
76
77
78
79
80
  !lc> #include <complex.h>

  !lc> /*! \brief C old, deprecated interface, will be deleted. Use "elpa_get_communicators"
  !lc> *
  !lc> * \param mpi_comm_word    MPI global communicator (in)
  !lc> * \param my_prow          Row coordinate of the calling process in the process grid (in)
  !lc> * \param my_pcol          Column coordinate of the calling process in the process grid (in)
  !lc> * \param mpi_comm_rows    Communicator for communicating within rows of processes (out)
  !lc> * \result int             integer error value of mpi_comm_split function
  !lc> */
  !lc> int get_elpa_communicators(int mpi_comm_world, int my_prow, int my_pcol, int *mpi_comm_rows, int *mpi_comm_cols);
81
82
83
84
  function get_elpa_row_col_comms_wrapper_c_name2(mpi_comm_world, my_prow, my_pcol, &
                                          mpi_comm_rows, mpi_comm_cols)     &
                                          result(mpierr) bind(C,name="get_elpa_communicators")
    use, intrinsic :: iso_c_binding
85
    use elpa1, only : elpa_get_communicators
86
87
88
89
90
91

    implicit none
    integer(kind=c_int)         :: mpierr
    integer(kind=c_int), value  :: mpi_comm_world, my_prow, my_pcol
    integer(kind=c_int)         :: mpi_comm_rows, mpi_comm_cols

92
    mpierr = elpa_get_communicators(mpi_comm_world, my_prow, my_pcol, &
93
94
95
96
                                    mpi_comm_rows, mpi_comm_cols)

  end function

97
98
99
100
101
102
103
104
105
106
107
  !lc> #include <complex.h>

  !lc> /*! \brief C interface to create ELPA communicators
  !lc> *
  !lc> * \param mpi_comm_word    MPI global communicator (in)
  !lc> * \param my_prow          Row coordinate of the calling process in the process grid (in)
  !lc> * \param my_pcol          Column coordinate of the calling process in the process grid (in)
  !lc> * \param mpi_comm_rows    Communicator for communicating within rows of processes (out)
  !lc> * \result int             integer error value of mpi_comm_split function
  !lc> */
  !lc> int elpa_get_communicators(int mpi_comm_world, int my_prow, int my_pcol, int *mpi_comm_rows, int *mpi_comm_cols);
108
109
110
111
  function elpa_get_communicators_wrapper_c(mpi_comm_world, my_prow, my_pcol, &
                                          mpi_comm_rows, mpi_comm_cols)     &
                                          result(mpierr) bind(C,name="elpa_get_communicators")
    use, intrinsic :: iso_c_binding
112
    use elpa1, only : elpa_get_communicators
113
114
115
116
117
118
119
120
121
122

    implicit none
    integer(kind=c_int)         :: mpierr
    integer(kind=c_int), value  :: mpi_comm_world, my_prow, my_pcol
    integer(kind=c_int)         :: mpi_comm_rows, mpi_comm_cols

    mpierr = elpa_get_communicators(mpi_comm_world, my_prow, my_pcol, &
                                    mpi_comm_rows, mpi_comm_cols)

  end function
123
124


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
  !lc>  /*! \brief C interface to solve the double-precision real eigenvalue problem with 1-stage solver
  !lc>  *
  !lc> *  \param  na                   Order of matrix a
  !lc> *  \param  nev                  Number of eigenvalues needed.
  !lc> *                               The smallest nev eigenvalues/eigenvectors are calculated.
  !lc> *  \param  a                    Distributed matrix for which eigenvalues are to be computed.
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               The full matrix must be set (not only one half like in scalapack).
  !lc> *  \param lda                   Leading dimension of a
  !lc> *  \param ev(na)                On output: eigenvalues of a, every processor gets the complete set
  !lc> *  \param q                     On output: Eigenvectors of a
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               Must be always dimensioned to the full size (corresponding to (na,na))
  !lc> *                               even if only a part of the eigenvalues is needed.
  !lc> *  \param ldq                   Leading dimension of q
  !lc> *  \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> *  \param matrixCols           distributed number of matrix columns
  !lc> *  \param mpi_comm_rows        MPI-Communicator for rows
  !lc> *  \param mpi_comm_cols        MPI-Communicator for columns
  !lc> *  \param useGPU               use GPU (1=yes, 0=No)
  !lc> *
  !lc> *  \result                     int: 1 if error occured, otherwise 0
  !lc>*/
148
149
#define REALCASE 1
#define DOUBLE_PRECISION 1
150
#include "../../general/precision_macros.h"
151
  !lc> int elpa_solve_evp_real_1stage_double_precision(int na, int nev, double *a, int lda, double *ev, double *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
152

153
#include "./elpa1_c_interface_template.X90"
154
155
#undef REALCASE
#undef DOUBLE_PRECISION
156
157

#ifdef WANT_SINGLE_PRECISION_REAL
158

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
  !lc>  /*! \brief C interface to solve the single-precision real eigenvalue problem with 1-stage solver
  !lc>  *
  !lc> *  \param  na                   Order of matrix a
  !lc> *  \param  nev                  Number of eigenvalues needed.
  !lc> *                               The smallest nev eigenvalues/eigenvectors are calculated.
  !lc> *  \param  a                    Distributed matrix for which eigenvalues are to be computed.
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               The full matrix must be set (not only one half like in scalapack).
  !lc> *  \param lda                   Leading dimension of a
  !lc> *  \param ev(na)                On output: eigenvalues of a, every processor gets the complete set
  !lc> *  \param q                     On output: Eigenvectors of a
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               Must be always dimensioned to the full size (corresponding to (na,na))
  !lc> *                               even if only a part of the eigenvalues is needed.
  !lc> *  \param ldq                   Leading dimension of q
  !lc> *  \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> *  \param matrixCols           distributed number of matrix columns
  !lc> *  \param mpi_comm_rows        MPI-Communicator for rows
  !lc> *  \param mpi_comm_cols        MPI-Communicator for columns
  !lc> *  \param useGPU               use GPU (1=yes, 0=No)
  !lc> *
  !lc> *  \result                     int: 1 if error occured, otherwise 0
  !lc>*/
182
183
184
#define REALCASE 1
#undef DOUBLE_PRECISION
#define SINGLE_PRECISION 1
185
#include "../../general/precision_macros.h"
186

187
  !lc> int elpa_solve_evp_real_1stage_single_precision(int na, int nev, float *a, int lda, float *ev, float *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
188

189
#include "./elpa1_c_interface_template.X90"
190
191
#undef SINGLE_PRECISION
#undef REALCASE
192
193
#endif /* WANT_SINGLE_PRECISION_REAL */

194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
  !lc> /*! \brief C interface to solve the double-precision complex eigenvalue problem with 1-stage solver
  !lc> *
  !lc> *  \param  na                   Order of matrix a
  !lc> *  \param  nev                  Number of eigenvalues needed.
  !lc> *                               The smallest nev eigenvalues/eigenvectors are calculated.
  !lc> *  \param  a                    Distributed matrix for which eigenvalues are to be computed.
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               The full matrix must be set (not only one half like in scalapack).
  !lc> *  \param lda                   Leading dimension of a
  !lc> *  \param ev(na)                On output: eigenvalues of a, every processor gets the complete set
  !lc> *  \param q                     On output: Eigenvectors of a
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               Must be always dimensioned to the full size (corresponding to (na,na))
  !lc> *                               even if only a part of the eigenvalues is needed.
  !lc> *  \param ldq                   Leading dimension of q
  !lc> *  \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> *  \param matrixCols           distributed number of matrix columns
  !lc> *  \param mpi_comm_rows        MPI-Communicator for rows
  !lc> *  \param mpi_comm_cols        MPI-Communicator for columns
  !lc> *  \param useGPU               use GPU (1=yes, 0=No)
  !lc> *
  !lc> *  \result                     int: 1 if error occured, otherwise 0
  !lc> */
217

218
219
#define COMPLEXCASE 1
#define DOUBLE_PRECISION 1
220
#include "../../general/precision_macros.h"
Andreas Marek's avatar
Andreas Marek committed
221

222
  !lc> int elpa_solve_evp_complex_1stage_double_precision(int na, int nev, double complex *a, int lda, double *ev, double complex *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
Andreas Marek's avatar
Andreas Marek committed
223

224
#include "./elpa1_c_interface_template.X90"
225
226
#undef COMPLEXCASE
#undef DOUBLE_PRECISION
227
228
229

#ifdef WANT_SINGLE_PRECISION_COMPLEX

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
  !lc> /*! \brief C interface to solve the single-precision complex eigenvalue problem with 1-stage solver
  !lc> *
  !lc> *  \param  na                   Order of matrix a
  !lc> *  \param  nev                  Number of eigenvalues needed.
  !lc> *                               The smallest nev eigenvalues/eigenvectors are calculated.
  !lc> *  \param  a                    Distributed matrix for which eigenvalues are to be computed.
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               The full matrix must be set (not only one half like in scalapack).
  !lc> *  \param lda                   Leading dimension of a
  !lc> *  \param ev(na)                On output: eigenvalues of a, every processor gets the complete set
  !lc> *  \param q                     On output: Eigenvectors of a
  !lc> *                               Distribution is like in Scalapack.
  !lc> *                               Must be always dimensioned to the full size (corresponding to (na,na))
  !lc> *                               even if only a part of the eigenvalues is needed.
  !lc> *  \param ldq                   Leading dimension of q
  !lc> *  \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> *  \param matrixCols           distributed number of matrix columns
  !lc> *  \param mpi_comm_rows        MPI-Communicator for rows
  !lc> *  \param mpi_comm_cols        MPI-Communicator for columns
  !lc> *  \param useGPU               use GPU (1=yes, 0=No)
  !lc> *
  !lc> *  \result                     int: 1 if error occured, otherwise 0
  !lc> */
253
254
255
#define COMPLEXCASE 1
#undef DOUBLE_PRECISION
#define SINGLE_PRECISION
256
#include "../../general/precision_macros.h"
257

Andreas Marek's avatar
Andreas Marek committed
258
  !lc> int elpa_solve_evp_complex_1stage_single_precision(int na, int nev,  complex float *a, int lda, float *ev, complex float *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
259

260
#include "./elpa1_c_interface_template.X90"
261

262
263
#undef SINGLE_PRECISION
#undef COMPLEXCASE
264
265
#endif /* WANT_SINGLE_PRECISION_COMPLEX */

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
  !lc> /*
  !lc> \brief  C interface to solve double-precision tridiagonal eigensystem with divide and conquer method
  !lc> \details
  !lc>
  !lc> *\param na                    Matrix dimension
  !lc> *\param nev                   number of eigenvalues/vectors to be computed
  !lc> *\param d                     array d(na) on input diagonal elements of tridiagonal matrix, on
  !lc> *                             output the eigenvalues in ascending order
  !lc> *\param e                     array e(na) on input subdiagonal elements of matrix, on exit destroyed
  !lc> *\param q                     on exit : matrix q(ldq,matrixCols) contains the eigenvectors
  !lc> *\param ldq                   leading dimension of matrix q
  !lc> *\param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> *\param matrixCols            columns of matrix q
  !lc> *\param mpi_comm_rows         MPI communicator for rows
  !lc> *\param mpi_comm_cols         MPI communicator for columns
  !lc> *\param wantDebug             give more debug information if 1, else 0
  !lc> *\result success              int 1 on success, else 0
  !lc> */
  !lc> int elpa_solve_tridi_double(int na, int nev, double *d, double *e, double *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
285
286
#define REALCASE 1
#define DOUBLE_PRECISION 1
287
#include "../../general/precision_macros.h"
288
#include "./elpa_solve_tridi_c_interface_template.X90"
289
290
#undef DOUBLE_PRECISION
#undef REALCASE
291
292
293

#ifdef WANT_SINGLE_PRECISION_REAL

294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
  !lc> /*
  !lc> \brief  C interface to solve single-precision tridiagonal eigensystem with divide and conquer method
  !lc> \details
  !lc>
  !lc> \param na                    Matrix dimension
  !lc> \param nev                   number of eigenvalues/vectors to be computed
  !lc> \param d                     array d(na) on input diagonal elements of tridiagonal matrix, on
  !lc>                              output the eigenvalues in ascending order
  !lc> \param e                     array e(na) on input subdiagonal elements of matrix, on exit destroyed
  !lc> \param q                     on exit : matrix q(ldq,matrixCols) contains the eigenvectors
  !lc> \param ldq                   leading dimension of matrix q
  !lc> \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> \param matrixCols            columns of matrix q
  !lc> \param mpi_comm_rows         MPI communicator for rows
  !lc> \param mpi_comm_cols         MPI communicator for columns
  !lc> \param wantDebug             give more debug information if 1, else 0
  !lc> \result success              int 1 on success, else 0
  !lc> */
  !lc> int elpa_solve_tridi_single(int na, int nev, float *d, float *e, float *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
313
314
#define REALCASE 1
#define SINGLE_PRECISION 1
315
#include "../../general/precision_macros.h"
316
#include "./elpa_solve_tridi_c_interface_template.X90"
317
318
#undef SINGLE_PRECISION
#undef REALCASE
319

320
321
#endif /* WANT_SINGLE_PRECISION_REAL */

322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
  !lc> /*
  !lc> \brief  C interface for elpa_mult_at_b_real_double: Performs C : = A**T * B for double-precision matrices
  !lc>         where   A is a square matrix (na,na) which is optionally upper or lower triangular
  !lc>                 B is a (na,ncb) matrix
  !lc>                 C is a (na,ncb) matrix where optionally only the upper or lower
  !lc>                   triangle may be computed
  !lc> \details
  !lc> \param  uplo_a               'U' if A is upper triangular
  !lc>                              'L' if A is lower triangular
  !lc>                              anything else if A is a full matrix
  !lc>                              Please note: This pertains to the original A (as set in the calling program)
  !lc>                                           whereas the transpose of A is used for calculations
  !lc>                              If uplo_a is 'U' or 'L', the other triangle is not used at all,
  !lc>                              i.e. it may contain arbitrary numbers
  !lc> \param uplo_c                'U' if only the upper diagonal part of C is needed
  !lc>                              'L' if only the upper diagonal part of C is needed
  !lc>                              anything else if the full matrix C is needed
  !lc>                              Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
  !lc>                                            written to a certain extent, i.e. one shouldn't rely on the content there!
  !lc> \param na                    Number of rows/columns of A, number of rows of B and C
  !lc> \param ncb                   Number of columns  of B and C
  !lc> \param a                     matrix a
  !lc> \param lda                   leading dimension of matrix a
  !lc> \param ldaCols               columns of matrix a
  !lc> \param b                     matrix b
  !lc> \param ldb                   leading dimension of matrix b
  !lc> \param ldbCols               columns of matrix b
  !lc> \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> \param  mpi_comm_rows        MPI communicator for rows
  !lc> \param  mpi_comm_cols        MPI communicator for columns
  !lc> \param c                     matrix c
  !lc> \param ldc                   leading dimension of matrix c
  !lc> \param ldcCols               columns of matrix c
  !lc> \result success              int report success (1) or failure (0)
  !lc> */

  !lc> int elpa_mult_at_b_real_double(char uplo_a, char uplo_c, int na, int ncb, double *a, int lda, int ldaCols, double *b, int ldb, int ldbCols, int nlbk, int mpi_comm_rows, int mpi_comm_cols, double *c, int ldc, int ldcCols);
359

360
361
#define REALCASE 1
#define DOUBLE_PRECISION 1
362
#include "../../general/precision_macros.h"
363
#include "./elpa_mult_at_b_c_interface_template.X90"
364
365
#undef DOUBLE_PRECISION
#undef REALCASE
366

367
#ifdef WANT_SINGLE_PRECISION_REAL
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
  !lc> /*
  !lc> \brief  C interface for elpa_mult_at_b_real_single: Performs C : = A**T * B for single-precision matrices
  !lc>         where   A is a square matrix (na,na) which is optionally upper or lower triangular
  !lc>                 B is a (na,ncb) matrix
  !lc>                 C is a (na,ncb) matrix where optionally only the upper or lower
  !lc>                   triangle may be computed
  !lc> \details
  !lc> \param  uplo_a               'U' if A is upper triangular
  !lc>                              'L' if A is lower triangular
  !lc>                              anything else if A is a full matrix
  !lc>                              Please note: This pertains to the original A (as set in the calling program)
  !lc>                                           whereas the transpose of A is used for calculations
  !lc>                              If uplo_a is 'U' or 'L', the other triangle is not used at all,
  !lc>                              i.e. it may contain arbitrary numbers
  !lc> \param uplo_c                'U' if only the upper diagonal part of C is needed
  !lc>                              'L' if only the upper diagonal part of C is needed
  !lc>                              anything else if the full matrix C is needed
  !lc>                              Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
  !lc>                                            written to a certain extent, i.e. one shouldn't rely on the content there!
  !lc> \param na                    Number of rows/columns of A, number of rows of B and C
  !lc> \param ncb                   Number of columns  of B and C
  !lc> \param a                     matrix a
  !lc> \param lda                   leading dimension of matrix a
  !lc> \param ldaCols               columns of matrix a
  !lc> \param b                     matrix b
  !lc> \param ldb                   leading dimension of matrix b
  !lc> \param ldbCols               columns of matrix b
  !lc> \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> \param  mpi_comm_rows        MPI communicator for rows
  !lc> \param  mpi_comm_cols        MPI communicator for columns
  !lc> \param c                     matrix c
  !lc> \param ldc                   leading dimension of matrix c
  !lc> \result success              int report success (1) or failure (0)
  !lc> */

  !lc> int elpa_mult_at_b_real_single(char uplo_a, char uplo_c, int na, int ncb, float *a, int lda, int ldaCols, float *b, int ldb, int ldbCols, int nlbk, int mpi_comm_rows, int mpi_comm_cols, float *c, int ldc, int ldcCols);
404
405


406
407
#define REALCASE 1
#define SINGLE_PRECISION 1
408
#include "../../general/precision_macros.h"
409
#include "./elpa_mult_at_b_c_interface_template.X90"
410
411
#undef SINGLE_PRECISION
#undef REALCASE
412
413
414

#endif /* WANT_SINGLE_PRECISION_REAL */

415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
  !lc> /*
  !lc> \brief C interface for elpa_mult_ah_b_complex_double: Performs C : = A**H * B for double-precision matrices
  !lc>         where   A is a square matrix (na,na) which is optionally upper or lower triangular
  !lc>                 B is a (na,ncb) matrix
  !lc>                 C is a (na,ncb) matrix where optionally only the upper or lower
  !lc>                   triangle may be computed
  !lc> \details
  !lc>
  !lc> \param  uplo_a               'U' if A is upper triangular
  !lc>                              'L' if A is lower triangular
  !lc>                              anything else if A is a full matrix
  !lc>                              Please note: This pertains to the original A (as set in the calling program)
  !lc>                                           whereas the transpose of A is used for calculations
  !lc>                              If uplo_a is 'U' or 'L', the other triangle is not used at all,
  !lc>                              i.e. it may contain arbitrary numbers
  !lc> \param uplo_c                'U' if only the upper diagonal part of C is needed
  !lc>                              'L' if only the upper diagonal part of C is needed
  !lc>                              anything else if the full matrix C is needed
  !lc>                              Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
  !lc>                                            written to a certain extent, i.e. one shouldn't rely on the content there!
  !lc> \param na                    Number of rows/columns of A, number of rows of B and C
  !lc> \param ncb                   Number of columns  of B and C
  !lc> \param a                     matrix a
  !lc> \param lda                   leading dimension of matrix a
  !lc> \param b                     matrix b
  !lc> \param ldb                   leading dimension of matrix b
  !lc> \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> \param  mpi_comm_rows        MPI communicator for rows
  !lc> \param  mpi_comm_cols        MPI communicator for columns
  !lc> \param c                     matrix c
  !lc> \param ldc                   leading dimension of matrix c
  !lc> \result success              int reports success (1) or failure (0)
  !lc> */

  !lc> int elpa_mult_ah_b_complex_double(char uplo_a, char uplo_c, int na, int ncb, double complex *a, int lda, int ldaCols, double complex *b, int ldb, int ldbCols, int nblk, int mpi_comm_rows, int mpi_comm_cols, double complex *c, int ldc, int ldcCols);
450
451
#define COMPLEXCASE 1
#define DOUBLE_PRECISION 1
452
#include "../../general/precision_macros.h"
453
#include "./elpa_mult_ah_b_c_interface_template.X90"
454
455
#undef DOUBLE_PRECISION
#undef COMPLEXCASE
456
457


458
459
#ifdef WANT_SINGLE_PRECISION_COMPLEX

460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
  !lc> /*
  !lc> \brief C interface for elpa_mult_ah_b_complex_single: Performs C : = A**H * B for single-precision matrices
  !lc>         where   A is a square matrix (na,na) which is optionally upper or lower triangular
  !lc>                 B is a (na,ncb) matrix
  !lc>                 C is a (na,ncb) matrix where optionally only the upper or lower
  !lc>                   triangle may be computed
  !lc> \details
  !lc>
  !lc> \param  uplo_a               'U' if A is upper triangular
  !lc>                              'L' if A is lower triangular
  !lc>                              anything else if A is a full matrix
  !lc>                              Please note: This pertains to the original A (as set in the calling program)
  !lc>                                           whereas the transpose of A is used for calculations
  !lc>                              If uplo_a is 'U' or 'L', the other triangle is not used at all,
  !lc>                              i.e. it may contain arbitrary numbers
  !lc> \param uplo_c                'U' if only the upper diagonal part of C is needed
  !lc>                              'L' if only the upper diagonal part of C is needed
  !lc>                              anything else if the full matrix C is needed
  !lc>                              Please note: Even when uplo_c is 'U' or 'L', the other triangle may be
  !lc>                                            written to a certain extent, i.e. one shouldn't rely on the content there!
  !lc> \param na                    Number of rows/columns of A, number of rows of B and C
  !lc> \param ncb                   Number of columns  of B and C
  !lc> \param a                     matrix a
  !lc> \param lda                   leading dimension of matrix a
  !lc> \param b                     matrix b
  !lc> \param ldb                   leading dimension of matrix b
  !lc> \param nblk                  blocksize of cyclic distribution, must be the same in both directions!
  !lc> \param  mpi_comm_rows        MPI communicator for rows
  !lc> \param  mpi_comm_cols        MPI communicator for columns
  !lc> \param c                     matrix c
  !lc> \param ldc                   leading dimension of matrix c
  !lc> \result success              int reports success (1) or failure (0)
  !lc> */

Andreas Marek's avatar
Andreas Marek committed
494
  !lc> int elpa_mult_ah_b_complex_single(char uplo_a, char uplo_c, int na, int ncb, complex float *a, int lda, int ldaCols, complex float *b, int ldb, int ldbCols, int nblk, int mpi_comm_rows, int mpi_comm_cols, complex float *c, int ldc, int ldcCols);
495
496
#define COMPLEXCASE 1
#define SINGLE_PRECISION 1
497
#include "../../general/precision_macros.h"
498
#include "./elpa_mult_ah_b_c_interface_template.X90"
499
500
#undef SINGLE_PRECISION
#undef COMPLEXCASE
501
502
#endif /* WANT_SINGLE_PRECISION_COMPLEX */

503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
  !lc> /*
  !lc> \brief  C interface to elpa_invert_trm_real_double: Inverts a real double-precision upper triangular matrix
  !lc> \details
  !lc> \param  na                   Order of matrix
  !lc> \param  a(lda,matrixCols)    Distributed matrix which should be inverted
  !lc>                              Distribution is like in Scalapack.
  !lc>                              Only upper triangle is needs to be set.
  !lc>                              The lower triangle is not referenced.
  !lc> \param  lda                  Leading dimension of a
  !lc> \param                       matrixCols  local columns of matrix a
  !lc> \param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
  !lc> \param  mpi_comm_rows        MPI communicator for rows
  !lc> \param  mpi_comm_cols        MPI communicator for columns
  !lc> \param wantDebug             int more debug information on failure if 1, else 0
  !lc> \result succes               int reports success (1) or failure (0)
  !lc> */

  !lc> int elpa_invert_trm_real_double(int na, double *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
521
522
#define REALCASE 1
#define DOUBLE_PRECISION 1
523
#include "../../general/precision_macros.h"
524
#include "./elpa_invert_trm_c_interface_template.X90"
525
526
#undef DOUBLE_PRECISION
#undef REALCASE
527

528
529
#ifdef WANT_SINGLE_PRECISION_REAL

530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
  !lc> /*
  !lc> \brief  C interface to elpa_invert_trm_real_single: Inverts a real single-precision upper triangular matrix
  !lc> \details
  !lc> \param  na                   Order of matrix
  !lc> \param  a(lda,matrixCols)    Distributed matrix which should be inverted
  !lc>                              Distribution is like in Scalapack.
  !lc>                              Only upper triangle is needs to be set.
  !lc>                              The lower triangle is not referenced.
  !lc> \param  lda                  Leading dimension of a
  !lc> \param                       matrixCols  local columns of matrix a
  !lc> \param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
  !lc> \param  mpi_comm_rows        MPI communicator for rows
  !lc> \param  mpi_comm_cols        MPI communicator for columns
  !lc> \param wantDebug             int more debug information on failure if 1, else 0
  !lc> \result succes               int reports success (1) or failure (0)
  !lc> */

  !lc> int elpa_invert_trm_real_single(int na, double *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
548

549
550
#define REALCASE 1
#define SINGLE_PRECISION 1
551
#include "../../general/precision_macros.h"
552
#include "./elpa_invert_trm_c_interface_template.X90"
553
554
#undef SINGLE_PRECISION
#undef REALCASE
555
556
557

#endif /* WANT_SINGLE_PRECISION_REAL */

558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
 !lc> /*
 !lc> \brief  C interface to elpa_invert_trm_complex_double: Inverts a double-precision complex upper triangular matrix
 !lc> \details
 !lc> \param  na                   Order of matrix
 !lc> \param  a(lda,matrixCols)    Distributed matrix which should be inverted
 !lc>                              Distribution is like in Scalapack.
 !lc>                              Only upper triangle is needs to be set.
 !lc>                              The lower triangle is not referenced.
 !lc> \param  lda                  Leading dimension of a
 !lc> \param                       matrixCols  local columns of matrix a
 !lc> \param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
 !lc> \param  mpi_comm_rows        MPI communicator for rows
 !lc> \param  mpi_comm_cols        MPI communicator for columns
 !lc> \param wantDebug             int more debug information on failure if 1, else 0
 !lc> \result succes               int reports success (1) or failure (0)
 !lc> */

 !lc> int elpa_invert_trm_complex_double(int na, double complex *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
576
577
#define COMPLEXCASE 1
#define DOUBLE_PRECISION 1
578
#include "../../general/precision_macros.h"
579
#include "./elpa_invert_trm_c_interface_template.X90"
580
581
#undef DOUBLE_PRECISION
#undef COMPLEXCASE
582

583
#ifdef WANT_SINGLE_PRECISION_COMPLEX
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
 !lc> /*
 !lc> \brief  C interface to elpa_invert_trm_complex_single: Inverts a single-precision complex upper triangular matrix
 !lc> \details
 !lc> \param  na                   Order of matrix
 !lc> \param  a(lda,matrixCols)    Distributed matrix which should be inverted
 !lc>                              Distribution is like in Scalapack.
 !lc>                              Only upper triangle is needs to be set.
 !lc>                              The lower triangle is not referenced.
 !lc> \param  lda                  Leading dimension of a
 !lc> \param                       matrixCols  local columns of matrix a
 !lc> \param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
 !lc> \param  mpi_comm_rows        MPI communicator for rows
 !lc> \param  mpi_comm_cols        MPI communicator for columns
 !lc> \param wantDebug             int more debug information on failure if 1, else 0
 !lc> \result succes               int reports success (1) or failure (0)
 !lc> */

Andreas Marek's avatar
Andreas Marek committed
601
 !lc> int elpa_invert_trm_complex_single(int na, complex float *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
602
603
#define COMPLEXCASE 1
#define SINGLE_PRECISION 1
604
#include "../../general/precision_macros.h"
605
#include "./elpa_invert_trm_c_interface_template.X90"
606
607
#undef SINGLE_PRECISION
#undef COMPLEXCASE
608

609
610
611

#endif /* WANT_SINGLE_PRECISION_COMPLEX */

612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
 !lc> /*
 !lc> \brief  elpa_cholesky_real_double: Cholesky factorization of a double-precision real symmetric matrix
 !lc> \details
 !lc>
 !lc> *\param  na                   Order of matrix
 !lc> *\param  a(lda,matrixCols)    Distributed matrix which should be factorized.
 !lc> *                             Distribution is like in Scalapack.
 !lc> *                             Only upper triangle is needs to be set.
 !lc> *                             On return, the upper triangle contains the Cholesky factor
 !lc> *                             and the lower triangle is set to 0.
 !lc> *\param  lda                  Leading dimension of a
 !lc> *\param  matrixCols           local columns of matrix a
 !lc> *\param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
 !lc> *\param  mpi_comm_rows        MPI communicator for rows
 !lc> *\param  mpi_comm_cols        MPI communicator for columns
 !lc> *\param wantDebug             int more debug information on failure if 1, else 0
 !lc> *\result succes               int reports success (1) or failure (0)
 !lc> */

 !lc> int elpa_cholesky_real_double(int na, double *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
632
633
#define REALCASE 1
#define DOUBLE_PRECISION 1
634
#include "../../general/precision_macros.h"
635
#include "./elpa_cholesky_c_interface_template.X90"
636
637
#undef DOUBLE_PRECISION
#undef REALCASE
638
639
640

#ifdef WANT_SINGLE_PRECISION_REAL

641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
 !lc> /*
 !lc> \brief  elpa_cholesky_real_single: Cholesky factorization of a single-precision real symmetric matrix
 !lc> \details
 !lc>
 !lc> \param  na                   Order of matrix
 !lc> \param  a(lda,matrixCols)    Distributed matrix which should be factorized.
 !lc>                              Distribution is like in Scalapack.
 !lc>                              Only upper triangle is needs to be set.
 !lc>                              On return, the upper triangle contains the Cholesky factor
 !lc>                              and the lower triangle is set to 0.
 !lc> \param  lda                  Leading dimension of a
 !lc> \param                       matrixCols  local columns of matrix a
 !lc> \param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
 !lc> \param  mpi_comm_rows        MPI communicator for rows
 !lc> \param  mpi_comm_cols        MPI communicator for columns
 !lc> \param wantDebug             int more debug information on failure if 1, else 0
 !lc> \result succes               int reports success (1) or failure (0)
 !lc> */

 !lc> int elpa_cholesky_real_single(int na, float *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
661
662
#define REALCASE 1
#define SINGLE_PRECISION 1
663
#include "../../general/precision_macros.h"
664
#include "./elpa_cholesky_c_interface_template.X90"
665
666
#undef SINGLE_PRECISION
#undef REALCASE
667
668


669
670
#endif /* WANT_SINGLE_PRECISION_REAL */

671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
 !lc> /*
 !lc> \brief  C interface elpa_cholesky_complex_double: Cholesky factorization of a double-precision complex hermitian matrix
 !lc> \details
 !lc> \param  na                   Order of matrix
 !lc> \param  a(lda,matrixCols)    Distributed matrix which should be factorized.
 !lc>                              Distribution is like in Scalapack.
 !lc>                              Only upper triangle is needs to be set.
 !lc>                              On return, the upper triangle contains the Cholesky factor
 !lc>                              and the lower triangle is set to 0.
 !lc> \param  lda                  Leading dimension of a
 !lc> \param                       matrixCols  local columns of matrix a
 !lc> \param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
 !lc> \param  mpi_comm_rows        MPI communicator for rows
 !lc> \param  mpi_comm_cols        MPI communicator for columns
 !lc> \param wantDebug             int more debug information on failure, if 1, else 0
 !lc> \result succes               int reports success (1) or failure (0)
 !lc> */

 !lc> int elpa_cholesky_complex_double(int na, double complex *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
690
691
#define COMPLEXCASE 1
#define DOUBLE_PRECISION 1
692
#include "../../general/precision_macros.h"
693
#include "./elpa_cholesky_c_interface_template.X90"
694
695
#undef DOUBLE_PRECISION
#undef COMPLEXCASE
696
697
698

#ifdef WANT_SINGLE_PRECISION_COMPLEX

699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
 !lc> /*
 !lc> \brief  C interface elpa_cholesky_complex_single: Cholesky factorization of a single-precision complex hermitian matrix
 !lc> \details
 !lc> \param  na                   Order of matrix
 !lc> \param  a(lda,matrixCols)    Distributed matrix which should be factorized.
 !lc>                              Distribution is like in Scalapack.
 !lc>                              Only upper triangle is needs to be set.
 !lc>                              On return, the upper triangle contains the Cholesky factor
 !lc>                              and the lower triangle is set to 0.
 !lc> \param  lda                  Leading dimension of a
 !lc> \param                       matrixCols  local columns of matrix a
 !lc> \param  nblk                 blocksize of cyclic distribution, must be the same in both directions!
 !lc> \param  mpi_comm_rows        MPI communicator for rows
 !lc> \param  mpi_comm_cols        MPI communicator for columns
 !lc> \param wantDebug             int more debug information on failure, if 1, else 0
 !lc> \result succes               int reports success (1) or failure (0)
 !lc> */

Andreas Marek's avatar
Andreas Marek committed
717
 !lc> int elpa_cholesky_complex_single(int na, complex float *a, int lda, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int wantDebug);
718
719
#define COMPLEXCASE 1
#define SINGLE_PRECISION 1
720
#include "../../general/precision_macros.h"
721
#include "./elpa_cholesky_c_interface_template.X90"
722
723
#undef SINGLE_PRECISION
#undef COMPLEXCASE
724
#endif /* WANT_SINGLE_PRECISION_COMPLEX */