ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
elpa_generic.h
Go to the documentation of this file.
1#ifndef ABACUS_SOURCE_HSOLVER_MODULE_GENELPA_ELPA_GENERIC_H
2#define ABACUS_SOURCE_HSOLVER_MODULE_GENELPA_ELPA_GENERIC_H
3
4#include "elpa_new.h"
5#include <complex>
15inline void elpa_set(elpa_t handle, const char *name, int value, int *error)
16{
17 elpa_set_integer(handle, name, value, error);
18}
19inline void elpa_set(elpa_t handle, const char *name, double value, int *error)
20{
21 elpa_set_double(handle, name, value, error);
22}
23
33inline void elpa_get(elpa_t handle, const char *name, int *value, int *error)
34{
35 elpa_get_integer(handle, name, value, error);
36}
37inline void elpa_get(elpa_t handle, const char *name, double *value, int *error)
38{
39 elpa_get_double(handle, name, value, error);
40}
41
52#if ELPA_API_VERSION <= 20210502 // ELPA 2021.05.002 and earlier versions
53inline void elpa_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
54{
55 elpa_eigenvectors_d(handle, a, ev, q, error);
56}
57
58inline void elpa_eigenvectors(const elpa_t handle, float *a, float *ev, float *q, int *error)
59{
60 elpa_eigenvectors_f(handle, a, ev, q, error);
61}
62
63inline void elpa_eigenvectors(const elpa_t handle, std::complex<double> *a, double *ev, std::complex<double> *q, int *error)
64{
65 elpa_eigenvectors_dc(handle, reinterpret_cast<double _Complex*>(a), ev, reinterpret_cast<double _Complex*>(q), error);
66}
67
68inline void elpa_eigenvectors(const elpa_t handle, std::complex<float> *a, float *ev, std::complex<float> *q, int *error)
69{
70 elpa_eigenvectors_fc(handle, reinterpret_cast<float _Complex*>(a), ev, reinterpret_cast<float _Complex*>(q), error);
71}
72#elif ELPA_API_VERSION < 20220501 // ELPA version between 2021.11.001 and 2022.05.001
73inline void elpa_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
74{
75 elpa_eigenvectors_all_host_arrays_d(handle, a, ev, q, error);
76}
77
78inline void elpa_eigenvectors(const elpa_t handle, float *a, float *ev, float *q, int *error)
79{
80 elpa_eigenvectors_all_host_arrays_f(handle, a, ev, q, error);
81}
82
83inline void elpa_eigenvectors(const elpa_t handle, std::complex<double> *a, double *ev, std::complex<double> *q, int *error)
84{
85 elpa_eigenvectors_all_host_arrays_dc(handle, reinterpret_cast<double _Complex*>(a),
86 ev, reinterpret_cast<double _Complex*>(q), error);
87}
88
89inline void elpa_eigenvectors(const elpa_t handle, std::complex<float> *a, float *ev, std::complex<float> *q, int *error)
90{
91 elpa_eigenvectors_all_host_arrays_fc(handle, reinterpret_cast<float _Complex*>(a),
92 ev, reinterpret_cast<float _Complex*>(q), error);
93}
94#else // ELPA version 2022.05.001, ELPA has its own c++ interface from version 2022.11.001
95inline void elpa_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
96{
97 elpa_eigenvectors_a_h_a_d(handle, a, ev, q, error);
98}
99
100inline void elpa_eigenvectors(const elpa_t handle, float *a, float *ev, float *q, int *error)
101{
102 elpa_eigenvectors_a_h_a_f(handle, a, ev, q, error);
103}
104
105inline void elpa_eigenvectors(const elpa_t handle, std::complex<double> *a, double *ev, std::complex<double> *q, int *error)
106{
107 elpa_eigenvectors_a_h_a_dc(handle, reinterpret_cast<double _Complex*>(a),
108 ev, reinterpret_cast<double _Complex*>(q), error);
109}
110
111inline void elpa_eigenvectors(const elpa_t handle, std::complex<float> *a, float *ev, std::complex<float> *q, int *error)
112{
113 elpa_eigenvectors_a_h_a_fc(handle, reinterpret_cast<float _Complex*>(a),
114 ev, reinterpret_cast<float _Complex*>(q), error);
115}
116#endif
117
128#if ELPA_API_VERSION <= 20210502 // ELPA 2021.05.002 and earlier versions
129inline void elpa_skew_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
130{
131 elpa_eigenvectors_d(handle, a, ev, q, error);
132}
133
134inline void elpa_skew_eigenvectors(const elpa_t handle, float *a, float *ev, float *q, int *error)
135{
136 elpa_eigenvectors_f(handle, a, ev, q, error);
137}
138#elif ELPA_API_VERSION < 20220501 // ELPA version between 2021.11.001 and 2022.05.001
139inline void elpa_skew_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
140{
141 elpa_skew_eigenvectors_all_host_arrays_d(handle, a, ev, q, error);
142}
143
144inline void elpa_skew_eigenvectors(const elpa_t handle, float *a, float *ev, float *q, int *error)
145{
146 elpa_skew_eigenvectors_all_host_arrays_f(handle, a, ev, q, error);
147}
148#else // ELPA version 2022.05.001, ELPA has its own c++ interface from version 2022.11.001
149inline void elpa_skew_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
150{
151 elpa_skew_eigenvectors_a_h_a_d(handle, a, ev, q, error);
152}
153
154inline void elpa_skew_eigenvectors(const elpa_t handle, float *a, float *ev, float *q, int *error)
155{
156 elpa_skew_eigenvectors_a_h_a_f(handle, a, ev, q, error);
157}
158#endif
159
160
161
174inline void elpa_generalized_eigenvectors(elpa_t handle, double *a, double *b, double *ev, double *q, int is_already_decomposed, int *error)
175{
176 elpa_generalized_eigenvectors_d(handle, a, b, ev, q, is_already_decomposed, error);
177}
178
179inline void elpa_generalized_eigenvectors(elpa_t handle, float *a, float *b, float *ev, float *q, int is_already_decomposed, int *error)
180{
181 elpa_generalized_eigenvectors_f(handle, a, b, ev, q, is_already_decomposed, error);
182}
183
184inline void elpa_generalized_eigenvectors(elpa_t handle, std::complex<double> *a, std::complex<double> *b, double *ev, std::complex<double> *q, int is_already_decomposed, int *error)
185{
186 elpa_generalized_eigenvectors_dc(handle, reinterpret_cast<double _Complex*>(a), reinterpret_cast<double _Complex*>(b),
187 ev, reinterpret_cast<double _Complex*>(q), is_already_decomposed, error);
188}
189
190inline void elpa_generalized_eigenvectors(elpa_t handle, std::complex<float> *a, std::complex<float> *b, float *ev, std::complex<float> *q, int is_already_decomposed, int *error)
191{
192 elpa_generalized_eigenvectors_fc(handle, reinterpret_cast<float _Complex*>(a), reinterpret_cast<float _Complex*>(b),
193 ev, reinterpret_cast<float _Complex*>(q), is_already_decomposed, error);
194}
195
205#if ELPA_API_VERSION <= 20210502 // ELPA 2021.05.002 and earlier versions
206inline void elpa_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
207{
208 elpa_eigenvalues_d(handle, a, ev, error);
209}
210inline void elpa_eigenvalues(elpa_t handle, float *a, float *ev, int *error)
211{
212 elpa_eigenvalues_f(handle, a, ev, error);
213}
214inline void elpa_eigenvalues(elpa_t handle, std::complex<double> *a, double *ev, int *error)
215{
216 elpa_eigenvalues_dc(handle, reinterpret_cast<double _Complex*>(a), ev, error);
217}
218inline void elpa_eigenvalues(elpa_t handle, std::complex<float> *a, float *ev, int *error)
219{
220 elpa_eigenvalues_fc (handle, reinterpret_cast<float _Complex*>(a), ev, error);
221}
222#elif ELPA_API_VERSION < 20220501 // ELPA version between 2021.11.001 and 2022.05.001
223inline void elpa_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
224{
225 elpa_eigenvalues_all_host_arrays_d(handle, a, ev, error);
226}
227inline void elpa_eigenvalues(elpa_t handle, float *a, float *ev, int *error)
228{
229 elpa_eigenvalues_all_host_arrays_f(handle, a, ev, error);
230}
231inline void elpa_eigenvalues(elpa_t handle, std::complex<double> *a, double *ev, int *error)
232{
233 elpa_eigenvalues_all_host_arrays_dc(handle, reinterpret_cast<double _Complex*>(a), ev, error);
234}
235inline void elpa_eigenvalues(elpa_t handle, std::complex<float> *a, float *ev, int *error)
236{
237 elpa_eigenvalues_all_host_arrays_fc(handle, reinterpret_cast<float _Complex*>(a), ev, error);
238}
239#else // ELPA version 2022.05.001, ELPA has its own c++ interface from version 2022.11.001
240inline void elpa_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
241{
242 elpa_eigenvalues_a_h_a_d(handle, a, ev, error);
243}
244inline void elpa_eigenvalues(elpa_t handle, float *a, float *ev, int *error)
245{
246 elpa_eigenvalues_a_h_a_f(handle, a, ev, error);
247}
248inline void elpa_eigenvalues(elpa_t handle, std::complex<double> *a, double *ev, int *error)
249{
250 elpa_eigenvalues_a_h_a_dc(handle, reinterpret_cast<double _Complex*>(a), ev, error);
251}
252inline void elpa_eigenvalues(elpa_t handle, std::complex<float> *a, float *ev, int *error)
253{
254 elpa_eigenvalues_a_h_a_fc(handle, reinterpret_cast<float _Complex*>(a), ev, error);
255}
256#endif
257
267#if ELPA_API_VERSION <= 20210502 // ELPA 2021.05.002 and earlier versions
268inline void elpa_skew_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
269{
270 elpa_eigenvalues_d(handle, a, ev, error);
271}
272inline void elpa_skew_eigenvalues(elpa_t handle, float *a, float *ev, int *error)
273{
274 elpa_eigenvalues_f(handle, a, ev, error);
275}
276#elif ELPA_API_VERSION < 20220501 // ELPA version between 2021.11.001 and 2022.05.001
277inline void elpa_skew_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
278{
279 elpa_eigenvalues_all_host_arrays_d(handle, a, ev, error);
280}
281inline void elpa_skew_eigenvalues(elpa_t handle, float *a, float *ev, int *error)
282{
283 elpa_eigenvalues_all_host_arrays_f(handle, a, ev, error);
284}
285#else // ELPA version 2022.05.001, ELPA has its own c++ interface from version 2022.11.001
286inline void elpa_skew_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
287{
288 elpa_eigenvalues_a_h_a_d(handle, a, ev, error);
289}
290inline void elpa_skew_eigenvalues(elpa_t handle, float *a, float *ev, int *error)
291{
292 elpa_eigenvalues_a_h_a_f(handle, a, ev, error);
293}
294#endif
295
305
306#if ELPA_API_VERSION < 20220501 // ELPA version before 2022.05.001
307inline void elpa_cholesky(elpa_t handle, double *a, int *error)
308{
309 elpa_cholesky_d(handle, a, error);
310}
311inline void elpa_cholesky(elpa_t handle, float *a, int *error)
312{
313 elpa_cholesky_f(handle, a, error);
314}
315inline void elpa_cholesky(elpa_t handle, std::complex<double> *a, int *error)
316{
317 elpa_cholesky_dc(handle, reinterpret_cast<double _Complex*>(a), error);
318}
319inline void elpa_cholesky(elpa_t handle, std::complex<float> *a, int *error)
320{
321 elpa_cholesky_fc(handle, reinterpret_cast<float _Complex*>(a), error);
322}
323#else
324inline void elpa_cholesky(elpa_t handle, double *a, int *error)
325{
326 elpa_cholesky_a_h_a_d(handle, a, error);
327}
328inline void elpa_cholesky(elpa_t handle, float *a, int *error)
329{
330 elpa_cholesky_a_h_a_f(handle, a, error);
331}
332inline void elpa_cholesky(elpa_t handle, std::complex<double> *a, int *error)
333{
334 elpa_cholesky_a_h_a_dc(handle, reinterpret_cast<double _Complex*>(a), error);
335}
336inline void elpa_cholesky(elpa_t handle, std::complex<float> *a, int *error)
337{
338 elpa_cholesky_a_h_a_fc(handle, reinterpret_cast<float _Complex*>(a), error);
339}
340#endif
341
359#if ELPA_API_VERSION < 20220501 // ELPA version before 2022.05.001
360inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, double *a, double *b, int nrows_b, int ncols_b, double *c, int nrows_c, int ncols_c, int *error)
361{
362 elpa_hermitian_multiply_d(handle, uplo_a, uplo_c, ncb, a, b, nrows_b, ncols_b, c, nrows_c, ncols_c, error);
363}
364inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, float *a, float *b, int nrows_b, int ncols_b, float *c, int nrows_c, int ncols_c, int *error)
365{
366 elpa_hermitian_multiply_df(handle, uplo_a, uplo_c, ncb, a, b, nrows_b, ncols_b, c, nrows_c, ncols_c, error);
367}
368inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, std::complex<double> *a, std::complex<double> *b, int nrows_b, int ncols_b, std::complex<double> *c, int nrows_c, int ncols_c, int *error)
369{
370 elpa_hermitian_multiply_dc(handle, uplo_a, uplo_c, ncb, reinterpret_cast<double _Complex*>(a),
371 reinterpret_cast<double _Complex*>(b), nrows_b, ncols_b,
372 reinterpret_cast<double _Complex*>(c), nrows_c, ncols_c, error);
373}
374inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, std::complex<float> *a, std::complex<float> *b, int nrows_b, int ncols_b, std::complex<float> *c, int nrows_c, int ncols_c, int *error)
375{
376 elpa_hermitian_multiply_fc(handle, uplo_a, uplo_c, ncb, reinterpret_cast<float _Complex*>(a),
377 reinterpret_cast<float _Complex*>(b), nrows_b, ncols_b,
378 reinterpret_cast<float _Complex*>(c), nrows_c, ncols_c, error);
379}
380#else
381inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, double *a, double *b, int nrows_b, int ncols_b, double *c, int nrows_c, int ncols_c, int *error)
382{
383 elpa_hermitian_multiply_a_h_a_d(handle, uplo_a, uplo_c, ncb, a, b, nrows_b, ncols_b, c, nrows_c, ncols_c, error);
384}
385inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, float *a, float *b, int nrows_b, int ncols_b, float *c, int nrows_c, int ncols_c, int *error)
386{
387 elpa_hermitian_multiply_a_h_a_f(handle, uplo_a, uplo_c, ncb, a, b, nrows_b, ncols_b, c, nrows_c, ncols_c, error);
388}
389inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, std::complex<double> *a, std::complex<double> *b, int nrows_b, int ncols_b, std::complex<double> *c, int nrows_c, int ncols_c, int *error)
390{
391 elpa_hermitian_multiply_a_h_a_dc(handle, uplo_a, uplo_c, ncb, reinterpret_cast<double _Complex*>(a),
392 reinterpret_cast<double _Complex*>(b), nrows_b, ncols_b,
393 reinterpret_cast<double _Complex*>(c), nrows_c, ncols_c, error);
394}
395inline void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, std::complex<float> *a, std::complex<float> *b, int nrows_b, int ncols_b, std::complex<float> *c, int nrows_c, int ncols_c, int *error)
396{
397 elpa_hermitian_multiply_a_h_a_fc(handle, uplo_a, uplo_c, ncb, reinterpret_cast<float _Complex*>(a),
398 reinterpret_cast<float _Complex*>(b), nrows_b, ncols_b,
399 reinterpret_cast<float _Complex*>(c), nrows_c, ncols_c, error);
400}
401#endif
402
412#if ELPA_API_VERSION < 20220501 // ELPA version before 2022.05.001
413inline void elpa_invert_triangular(elpa_t handle, double *a, int *error)
414{
415 elpa_invert_trm_d(handle, a, error);
416}
417inline void elpa_invert_triangular(elpa_t handle, float *a, int *error)
418{
419 elpa_invert_trm_f(handle, a, error);
420}
421inline void elpa_invert_triangular(elpa_t handle, std::complex<double> *a, int *error)
422{
423 elpa_invert_trm_dc(handle, reinterpret_cast<double _Complex*>(a), error);
424}
425inline void elpa_invert_triangular(elpa_t handle, std::complex<float> *a, int *error)
426{
427 elpa_invert_trm_fc(handle, reinterpret_cast<float _Complex*>(a), error);
428}
429#else
430inline void elpa_invert_triangular(elpa_t handle, double *a, int *error)
431{
432 elpa_invert_trm_a_h_a_d(handle, a, error);
433}
434inline void elpa_invert_triangular(elpa_t handle, float *a, int *error)
435{
436 elpa_invert_trm_a_h_a_f(handle, a, error);
437}
438inline void elpa_invert_triangular(elpa_t handle, std::complex<double> *a, int *error)
439{
440 elpa_invert_trm_a_h_a_dc(handle, reinterpret_cast<double _Complex*>(a), error);
441}
442inline void elpa_invert_triangular(elpa_t handle, std::complex<float> *a, int *error)
443{
444 elpa_invert_trm_a_h_a_fc(handle, reinterpret_cast<float _Complex*>(a), error);
445}
446#endif
447
448#endif // ABACUS_SOURCE_HSOLVER_MODULE_GENELPA_ELPA_GENERIC_H
void elpa_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
generic C method for elpa_eigenvectors
Definition elpa_generic.h:53
void elpa_generalized_eigenvectors(elpa_t handle, double *a, double *b, double *ev, double *q, int is_already_decomposed, int *error)
generic C method for elpa_generalized_eigenvectors
Definition elpa_generic.h:174
void elpa_skew_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
generic C method for elpa_skew_eigenvalues
Definition elpa_generic.h:268
void elpa_get(elpa_t handle, const char *name, int *value, int *error)
generic C method for elpa_get
Definition elpa_generic.h:33
void elpa_eigenvalues(elpa_t handle, double *a, double *ev, int *error)
generic C method for elpa_eigenvalues
Definition elpa_generic.h:206
void elpa_cholesky(elpa_t handle, double *a, int *error)
generic C method for elpa_cholesky
Definition elpa_generic.h:307
void elpa_set(elpa_t handle, const char *name, int value, int *error)
generic C method for elpa_set
Definition elpa_generic.h:15
void elpa_hermitian_multiply(elpa_t handle, char uplo_a, char uplo_c, int ncb, double *a, double *b, int nrows_b, int ncols_b, double *c, int nrows_c, int ncols_c, int *error)
generic C method for elpa_hermitian_multiply
Definition elpa_generic.h:360
void elpa_skew_eigenvectors(const elpa_t handle, double *a, double *ev, double *q, int *error)
generic C method for elpa_skew_eigenvectors
Definition elpa_generic.h:129
void elpa_invert_triangular(elpa_t handle, double *a, int *error)
generic C method for elpa_invert_triangular
Definition elpa_generic.h:413
struct elpa_struct * elpa_t
Definition elpa_new.h:17