Repository navigation
Expand file tree
/
Copy pathgather_math_lib_info.cpp
More file actions
80 lines (74 loc) · 2.91 KB
/
Copy pathgather_math_lib_info.cpp
File metadata and controls
80 lines (74 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// This file defines the math lib wrapper for output information before executing computations.
/*
When INFO is defined in cmake configure, a macro of GATHER_INFO will be defined.
This macro will be used to output information before executing computations.
Results will output to OUT/math_info.log, see ModuleBase::Global_File::make_dir_out .
*/
#include <ostream>
#undef GATHER_INFO
#include "source_base/module_external/blas_connector.h"
#include "source_base/module_external/lapack_connector.h"
#include <iostream>
void zgemm_i(const char *transa,
const char *transb,
const int *m,
const int *n,
const int *k,
const std::complex<double> *alpha,
const std::complex<double> *a,
const int *lda,
const std::complex<double> *b,
const int *ldb,
const std::complex<double> *beta,
std::complex<double> *c,
const int *ldc)
{
GlobalV::ofs_info.unsetf(std::ios_base::floatfield);
GlobalV::ofs_info << "zgemm " << *transa << " " << *transb << " " << *m << " " << *n << " "
<< *k << " " << *alpha << " " << *lda << " " << *ldb << " " << *beta << " " << *ldc << std::endl;
zgemm_(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc);
}
void zaxpy_i(const int *N,
const std::complex<double> *alpha,
const std::complex<double> *X,
const int *incX,
std::complex<double> *Y,
const int *incY)
{
// std::cout << "zaxpy " << *N << std::endl;
// alpha is a coefficient
// incX, incY is always 1
zaxpy_(N, alpha, X, incX, Y, incY);
}
void zhegvx_i(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)
{
GlobalV::ofs_info.unsetf(std::ios_base::floatfield);
GlobalV::ofs_info << "zhegvx " << *itype << " " << *jobz << " " << *range << " " << *uplo
<< " " << *n << " " << *lda << " " << *ldb << " " << *vl << " " << *vu << " " << *il << " " << *iu
<< " " << *abstol << " " << *m << " " << *lwork << " " << *info << std::endl;
zhegvx_(itype, jobz, range, uplo, n, a, lda, b, ldb, vl, vu, il, iu, abstol, m, w, z, ldz, work, lwork, rwork,
iwork, ifail, info);
}