ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
lapack_wrapper.h
Go to the documentation of this file.
1#ifndef LAPACK_HPP
2#define LAPACK_HPP
3#include <iostream>
4extern "C"
5{
6 // =================================================================================
7 // gvd:
8 void dsygvd_(const int* itype, const char* jobz, const char* uplo, const int* n,
9 double* a, const int* lda,
10 const double* b, const int* ldb, double* w,
11 double* work, int* lwork,
12 int* iwork, int* liwork, int* info);
13
14 void chegvd_(const int* itype, const char* jobz, const char* uplo, const int* n,
15 std::complex<float>* a, const int* lda,
16 const std::complex<float>* b, const int* ldb, float* w,
17 std::complex<float>* work, int* lwork, float* rwork, int* lrwork,
18 int* iwork, int* liwork, int* info);
19
20 void zhegvd_(const int* itype, const char* jobz, const char* uplo, const int* n,
21 std::complex<double>* a, const int* lda,
22 const std::complex<double>* b, const int* ldb, double* w,
23 std::complex<double>* work, int* lwork, double* rwork, int* lrwork,
24 int* iwork, int* liwork, int* info);
25 // =================================================================================
26
27 // =================================================================================
28 // evx
29 void dsyevx_(const char* jobz, const char* range, const char* uplo, const int* n,
30 double* a, const int* lda,
31 const double* vl, const double* vu, const int* il, const int* iu, const double* abstol,
32 const int* m, double* w, double* z, const int* ldz,
33 double* work, const int* lwork, double* rwork, int* iwork, int* ifail, int* info);
34
35 void cheevx_(const char* jobz, const char* range, const char* uplo, const int* n,
36 std::complex<float> *a, const int* lda,
37 const float* vl, const float* vu, const int* il, const int* iu, const float* abstol,
38 const int* m, float* w, std::complex<float> *z, const int *ldz,
39 std::complex<float> *work, const int* lwork, float* rwork, int* iwork, int* ifail, int* info);
40
41 void zheevx_(const char* jobz, const char* range, const char* uplo, const int* n,
42 std::complex<double> *a, const int* lda,
43 const double* vl, const double* vu, const int* il, const int* iu, const double* abstol,
44 const int* m, double* w, std::complex<double> *z, const int *ldz,
45 std::complex<double> *work, const int* lwork, double* rwork, int* iwork, int* ifail, int* info);
46 // =================================================================================
47
48
49 // =================================================================================
50 // gvx
51 void dsygvx_(const int* itype, const char* jobz, const char* range, const char* uplo,
52 const int* n, double* A, const int* lda, double* B, const int* ldb,
53 const double* vl, const double* vu, const int* il, const int* iu,
54 const double* abstol, const int* m, double* w, double* Z, const int* ldz,
55 double* work, const int* lwork, int* iwork, int* ifail, int* info);
56
57 void chegvx_(const int* itype,const char* jobz,const char* range,const char* uplo,
58 const int* n,std::complex<float> *a,const int* lda,std::complex<float> *b,
59 const int* ldb,const float* vl,const float* vu,const int* il,
60 const int* iu,const float* abstol,const int* m,float* w,
61 std::complex<float> *z,const int *ldz,std::complex<float> *work,const int* lwork,
62 float* rwork,int* iwork,int* ifail,int* info);
63
64 void zhegvx_(const int* itype,const char* jobz,const char* range,const char* uplo,
65 const int* n,std::complex<double> *a,const int* lda,std::complex<double> *b,
66 const int* ldb,const double* vl,const double* vu,const int* il,
67 const int* iu,const double* abstol,const int* m,double* w,
68 std::complex<double> *z,const int *ldz,std::complex<double> *work,const int* lwork,
69 double* rwork,int* iwork,int* ifail,int* info);
70 // =================================================================================
71
72 // =================================================================================
73 // gv
74 void zhegv_(const int* itype,const char* jobz,const char* uplo,const int* n,
75 std::complex<double>* a,const int* lda,std::complex<double>* b,const int* ldb,
76 double* w,std::complex<double>* work,int* lwork,double* rwork,int* info);
77 void chegv_(const int* itype,const char* jobz,const char* uplo,const int* n,
78 std::complex<float>* a,const int* lda,std::complex<float>* b,const int* ldb,
79 float* w,std::complex<float>* work,int* lwork,float* rwork,int* info);
80 void dsygv_(const int* itype, const char* jobz,const char* uplo, const int* n,
81 double* a,const int* lda,double* b,const int* ldb,
82 double* w,double* work,int* lwork,int* info);
83 // =================================================================================
84
85}
86
88{
89 private:
90 public:
91 // wrap function of fortran lapack routine zhegvd. (pointer version)
92 static inline void xhegvd(const int itype,
93 const char jobz,
94 const char uplo,
95 const int n,
96 double* a,
97 const int lda,
98 const double* b,
99 const int ldb,
100 double* w,
101 double* work,
102 int lwork,
103 double* rwork,
104 int lrwork,
105 int* iwork,
106 int liwork,
107 int& info)
108 {
109 // call the fortran routine
110 dsygvd_(&itype, &jobz, &uplo, &n, a, &lda, b, &ldb, w, work, &lwork, iwork, &liwork, &info);
111 }
112
113 // wrap function of fortran lapack routine zhegvd. (pointer version)
114 static inline void xhegvd(const int itype,
115 const char jobz,
116 const char uplo,
117 const int n,
118 std::complex<float>* a,
119 const int lda,
120 const std::complex<float>* b,
121 const int ldb,
122 float* w,
123 std::complex<float>* work,
124 int lwork,
125 float* rwork,
126 int lrwork,
127 int* iwork,
128 int liwork,
129 int& info)
130 {
131 // call the fortran routine
132 chegvd_(&itype, &jobz, &uplo, &n, a, &lda, b, &ldb, w, work, &lwork, rwork, &lrwork, iwork, &liwork, &info);
133 }
134
135 // wrap function of fortran lapack routine zhegvd.
136 static inline void xhegvd(const int itype,
137 const char jobz,
138 const char uplo,
139 const int n,
140 std::complex<double>* a,
141 const int lda,
142 const std::complex<double>* b,
143 const int ldb,
144 double* w,
145 std::complex<double>* work,
146 int lwork,
147 double* rwork,
148 int lrwork,
149 int* iwork,
150 int liwork,
151 int& info)
152 {
153 // call the fortran routine
154 zhegvd_(&itype, &jobz, &uplo, &n, a, &lda, b, &ldb, w, work, &lwork, rwork, &lrwork, iwork, &liwork, &info);
155 }
156
157 // wrap function of fortran lapack routine dsyevx.
158 static inline void xheevx(const int itype,
159 const char jobz,
160 const char range,
161 const char uplo,
162 const int n,
163 double* a,
164 const int lda,
165 const double vl,
166 const double vu,
167 const int il,
168 const int iu,
169 const double abstol,
170 const int m,
171 double* w,
172 double* z,
173 const int ldz,
174 double* work,
175 const int lwork,
176 double* rwork,
177 int* iwork,
178 int* ifail,
179 int& info)
180 {
181 dsyevx_(&jobz,
182 &range,
183 &uplo,
184 &n,
185 a,
186 &lda,
187 &vl,
188 &vu,
189 &il,
190 &iu,
191 &abstol,
192 &m,
193 w,
194 z,
195 &ldz,
196 work,
197 &lwork,
198 rwork,
199 iwork,
200 ifail,
201 &info);
202 }
203
204 // wrap function of fortran lapack routine cheevx.
205 static inline void xheevx(const int itype,
206 const char jobz,
207 const char range,
208 const char uplo,
209 const int n,
210 std::complex<float>* a,
211 const int lda,
212 const float vl,
213 const float vu,
214 const int il,
215 const int iu,
216 const float abstol,
217 const int m,
218 float* w,
219 std::complex<float>* z,
220 const int ldz,
221 std::complex<float>* work,
222 const int lwork,
223 float* rwork,
224 int* iwork,
225 int* ifail,
226 int& info)
227 {
228 cheevx_(&jobz,
229 &range,
230 &uplo,
231 &n,
232 a,
233 &lda,
234 &vl,
235 &vu,
236 &il,
237 &iu,
238 &abstol,
239 &m,
240 w,
241 z,
242 &ldz,
243 work,
244 &lwork,
245 rwork,
246 iwork,
247 ifail,
248 &info);
249 }
250
251 // wrap function of fortran lapack routine zheevx.
252 static inline void xheevx(const int itype,
253 const char jobz,
254 const char range,
255 const char uplo,
256 const int n,
257 std::complex<double>* a,
258 const int lda,
259 const double vl,
260 const double vu,
261 const int il,
262 const int iu,
263 const double abstol,
264 const int m,
265 double* w,
266 std::complex<double>* z,
267 const int ldz,
268 std::complex<double>* work,
269 const int lwork,
270 double* rwork,
271 int* iwork,
272 int* ifail,
273 int& info)
274 {
275 zheevx_(&jobz,
276 &range,
277 &uplo,
278 &n,
279 a,
280 &lda,
281 &vl,
282 &vu,
283 &il,
284 &iu,
285 &abstol,
286 &m,
287 w,
288 z,
289 &ldz,
290 work,
291 &lwork,
292 rwork,
293 iwork,
294 ifail,
295 &info);
296 }
297
298 // wrap function of fortran lapack routine xhegvx ( pointer version ).
299 static inline void xhegvx(const int itype,
300 const char jobz,
301 const char range,
302 const char uplo,
303 const int n,
304 std::complex<float>* a,
305 const int lda,
306 std::complex<float>* b,
307 const int ldb,
308 const float vl,
309 const float vu,
310 const int il,
311 const int iu,
312 const float abstol,
313 const int m,
314 float* w,
315 std::complex<float>* z,
316 const int ldz,
317 std::complex<float>* work,
318 const int lwork,
319 float* rwork,
320 int* iwork,
321 int* ifail,
322 int& info)
323 {
324 chegvx_(&itype,
325 &jobz,
326 &range,
327 &uplo,
328 &n,
329 a,
330 &lda,
331 b,
332 &ldb,
333 &vl,
334 &vu,
335 &il,
336 &iu,
337 &abstol,
338 &m,
339 w,
340 z,
341 &ldz,
342 work,
343 &lwork,
344 rwork,
345 iwork,
346 ifail,
347 &info);
348 }
349
350 // wrap function of fortran lapack routine xhegvx ( pointer version ).
351 static inline void xhegvx(const int itype,
352 const char jobz,
353 const char range,
354 const char uplo,
355 const int n,
356 std::complex<double>* a,
357 const int lda,
358 std::complex<double>* b,
359 const int ldb,
360 const double vl,
361 const double vu,
362 const int il,
363 const int iu,
364 const double abstol,
365 const int m,
366 double* w,
367 std::complex<double>* z,
368 const int ldz,
369 std::complex<double>* work,
370 const int lwork,
371 double* rwork,
372 int* iwork,
373 int* ifail,
374 int& info)
375 {
376 zhegvx_(&itype,
377 &jobz,
378 &range,
379 &uplo,
380 &n,
381 a,
382 &lda,
383 b,
384 &ldb,
385 &vl,
386 &vu,
387 &il,
388 &iu,
389 &abstol,
390 &m,
391 w,
392 z,
393 &ldz,
394 work,
395 &lwork,
396 rwork,
397 iwork,
398 ifail,
399 &info);
400 }
401 // wrap function of fortran lapack routine xhegvx ( pointer version ).
402 static inline void xhegvx(const int itype,
403 const char jobz,
404 const char range,
405 const char uplo,
406 const int n,
407 double* a,
408 const int lda,
409 double* b,
410 const int ldb,
411 const double vl,
412 const double vu,
413 const int il,
414 const int iu,
415 const double abstol,
416 const int m,
417 double* w,
418 double* z,
419 const int ldz,
420 double* work,
421 const int lwork,
422 double* rwork,
423 int* iwork,
424 int* ifail,
425 int& info)
426 {
427 dsygvx_(&itype, &jobz, &range, &uplo, &n, a, &lda, b, &ldb, &vl,
428 &vu, &il, &iu, &abstol, &m, w, z, &ldz, work, &lwork, iwork, ifail, &info);
429 }
430
431 // wrap function of fortran lapack routine xhegvx ( pointer version ).
432 static inline void xhegv(const int itype,
433 const char jobz,
434 const char uplo,
435 const int n,
436 double* a,
437 const int lda,
438 double* b,
439 const int ldb,
440 double* w,
441 double* work,
442 int lwork,
443 double* rwork,
444 int& info)
445 {
446 // TODO
447 }
448
449 // wrap function of fortran lapack routine xhegvx ( pointer version ).
450 static inline void xhegv(const int itype,
451 const char jobz,
452 const char uplo,
453 const int n,
454 std::complex<float>* a,
455 const int lda,
456 std::complex<float>* b,
457 const int ldb,
458 float* w,
459 std::complex<float>* work,
460 int lwork,
461 float* rwork,
462 int& info)
463 {
464 // TODO
465 }
466 // wrap function of fortran lapack routine xhegvx ( pointer version ).
467 static inline void xhegv(const int itype,
468 const char jobz,
469 const char uplo,
470 const int n,
471 std::complex<double>* a,
472 const int lda,
473 std::complex<double>* b,
474 const int ldb,
475 double* w,
476 std::complex<double>* work,
477 int lwork,
478 double* rwork,
479 int& info)
480 {
481 zhegv_(&itype, &jobz, &uplo, &n, a, &lda, b, &ldb, w, work, &lwork, rwork, &info);
482 }
483};
484#endif // LAPACK_HPP
Definition lapack_wrapper.h:88
static void xheevx(const int itype, const char jobz, const char range, const char uplo, const int n, double *a, const int lda, const double vl, const double vu, const int il, const int iu, const double abstol, const int m, double *w, double *z, const int ldz, double *work, const int lwork, double *rwork, int *iwork, int *ifail, int &info)
Definition lapack_wrapper.h:158
static void xhegv(const int itype, const char jobz, const char uplo, const int n, std::complex< double > *a, const int lda, std::complex< double > *b, const int ldb, double *w, std::complex< double > *work, int lwork, double *rwork, int &info)
Definition lapack_wrapper.h:467
static void xhegvx(const int itype, const char jobz, const char range, const char uplo, const int n, std::complex< float > *a, const int lda, std::complex< float > *b, const int ldb, const float vl, const float vu, const int il, const int iu, const float abstol, const int m, float *w, std::complex< float > *z, const int ldz, std::complex< float > *work, const int lwork, float *rwork, int *iwork, int *ifail, int &info)
Definition lapack_wrapper.h:299
static void xhegvx(const int itype, const char jobz, const char range, const char uplo, const int n, std::complex< double > *a, const int lda, std::complex< double > *b, const int ldb, const double vl, const double vu, const int il, const int iu, const double abstol, const int m, double *w, std::complex< double > *z, const int ldz, std::complex< double > *work, const int lwork, double *rwork, int *iwork, int *ifail, int &info)
Definition lapack_wrapper.h:351
static void xhegv(const int itype, const char jobz, const char uplo, const int n, std::complex< float > *a, const int lda, std::complex< float > *b, const int ldb, float *w, std::complex< float > *work, int lwork, float *rwork, int &info)
Definition lapack_wrapper.h:450
static void xhegvd(const int itype, const char jobz, const char uplo, const int n, std::complex< double > *a, const int lda, const std::complex< double > *b, const int ldb, double *w, std::complex< double > *work, int lwork, double *rwork, int lrwork, int *iwork, int liwork, int &info)
Definition lapack_wrapper.h:136
static void xhegv(const int itype, const char jobz, const char uplo, const int n, double *a, const int lda, double *b, const int ldb, double *w, double *work, int lwork, double *rwork, int &info)
Definition lapack_wrapper.h:432
static void xheevx(const int itype, const char jobz, const char range, const char uplo, const int n, std::complex< double > *a, const int lda, const double vl, const double vu, const int il, const int iu, const double abstol, const int m, double *w, std::complex< double > *z, const int ldz, std::complex< double > *work, const int lwork, double *rwork, int *iwork, int *ifail, int &info)
Definition lapack_wrapper.h:252
static void xhegvx(const int itype, const char jobz, const char range, const char uplo, const int n, double *a, const int lda, double *b, const int ldb, const double vl, const double vu, const int il, const int iu, const double abstol, const int m, double *w, double *z, const int ldz, double *work, const int lwork, double *rwork, int *iwork, int *ifail, int &info)
Definition lapack_wrapper.h:402
static void xhegvd(const int itype, const char jobz, const char uplo, const int n, double *a, const int lda, const double *b, const int ldb, double *w, double *work, int lwork, double *rwork, int lrwork, int *iwork, int liwork, int &info)
Definition lapack_wrapper.h:92
static void xheevx(const int itype, const char jobz, const char range, const char uplo, const int n, std::complex< float > *a, const int lda, const float vl, const float vu, const int il, const int iu, const float abstol, const int m, float *w, std::complex< float > *z, const int ldz, std::complex< float > *work, const int lwork, float *rwork, int *iwork, int *ifail, int &info)
Definition lapack_wrapper.h:205
static void xhegvd(const int itype, const char jobz, const char uplo, const int n, std::complex< float > *a, const int lda, const std::complex< float > *b, const int ldb, float *w, std::complex< float > *work, int lwork, float *rwork, int lrwork, int *iwork, int liwork, int &info)
Definition lapack_wrapper.h:114
void dsygvx_(const int *itype, const char *jobz, const char *range, const char *uplo, const int *n, double *A, const int *lda, double *B, const int *ldb, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, const int *m, double *w, double *Z, const int *ldz, double *work, const int *lwork, int *iwork, int *ifail, int *info)
void zhegvx_(const int *itype, const char *jobz, const char *range, const char *uplo, const int *n, std::complex< double > *a, const int *lda, std::complex< double > *b, const int *ldb, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, const int *m, double *w, std::complex< double > *z, const int *ldz, std::complex< double > *work, const int *lwork, double *rwork, int *iwork, int *ifail, int *info)
void dsyevx_(const char *jobz, const char *range, const char *uplo, const int *n, double *a, const int *lda, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, const int *m, double *w, double *z, const int *ldz, double *work, const int *lwork, double *rwork, int *iwork, int *ifail, int *info)
void chegv_(const int *itype, const char *jobz, const char *uplo, const int *n, std::complex< float > *a, const int *lda, std::complex< float > *b, const int *ldb, float *w, std::complex< float > *work, int *lwork, float *rwork, int *info)
void zhegvd_(const int *itype, const char *jobz, const char *uplo, const int *n, std::complex< double > *a, const int *lda, const std::complex< double > *b, const int *ldb, double *w, std::complex< double > *work, int *lwork, double *rwork, int *lrwork, int *iwork, int *liwork, int *info)
void zheevx_(const char *jobz, const char *range, const char *uplo, const int *n, std::complex< double > *a, const int *lda, const double *vl, const double *vu, const int *il, const int *iu, const double *abstol, const int *m, double *w, std::complex< double > *z, const int *ldz, std::complex< double > *work, const int *lwork, double *rwork, int *iwork, int *ifail, int *info)
void zhegv_(const int *itype, const char *jobz, const char *uplo, const int *n, std::complex< double > *a, const int *lda, std::complex< double > *b, const int *ldb, double *w, std::complex< double > *work, int *lwork, double *rwork, int *info)
void dsygvd_(const int *itype, const char *jobz, const char *uplo, const int *n, double *a, const int *lda, const double *b, const int *ldb, double *w, double *work, int *lwork, int *iwork, int *liwork, int *info)
void chegvd_(const int *itype, const char *jobz, const char *uplo, const int *n, std::complex< float > *a, const int *lda, const std::complex< float > *b, const int *ldb, float *w, std::complex< float > *work, int *lwork, float *rwork, int *lrwork, int *iwork, int *liwork, int *info)
void dsygv_(const int *itype, const char *jobz, const char *uplo, const int *n, double *a, const int *lda, double *b, const int *ldb, double *w, double *work, int *lwork, int *info)
void chegvx_(const int *itype, const char *jobz, const char *range, const char *uplo, const int *n, std::complex< float > *a, const int *lda, std::complex< float > *b, const int *ldb, const float *vl, const float *vu, const int *il, const int *iu, const float *abstol, const int *m, float *w, std::complex< float > *z, const int *ldz, std::complex< float > *work, const int *lwork, float *rwork, int *iwork, int *ifail, int *info)
void cheevx_(const char *jobz, const char *range, const char *uplo, const int *n, std::complex< float > *a, const int *lda, const float *vl, const float *vu, const int *il, const int *iu, const float *abstol, const int *m, float *w, std::complex< float > *z, const int *ldz, std::complex< float > *work, const int *lwork, float *rwork, int *iwork, int *ifail, int *info)