46 #ifndef _PEXSI_ENVIRONMENT_HPP_
47 #define _PEXSI_ENVIRONMENT_HPP_
92 #define _DEBUGlevel_ DEBUG
99 #define _DEBUGlevel -1
114 #define FORTRAN(name) name
115 #define BLAS(name) name
116 #define LAPACK(name) name
118 #define FORTRAN(name) name##_
119 #define BLAS(name) name##_
120 #define LAPACK(name) name##_
123 typedef int64_t LongInt;
125 typedef std::complex<double> Complex;
127 typedef std::complex<double> Scalar;
129 typedef double Scalar;
133 extern std::ofstream statusOFS;
135 extern std::ofstream statOFS;
137 extern std::deque<int > gemm_stat;
141 extern std::ofstream commOFS;
143 extern std::deque<int > comm_stat;
145 #define PROFILE_COMM(sender,receiver,tag,size)\
147 comm_stat.push_back(sender);\
148 comm_stat.push_back(receiver);\
149 comm_stat.push_back(tag);\
150 comm_stat.push_back(size);\
153 #define HEADER_COMM "Sender\tReceiver\tTag\tSize"
154 #define LINE_COMM(it) *it<<"\t"<<*(it+1)<<"\t"<<*(it+2)<<"\t"<<*(it+3)
158 #define PROFILE_COMM(sender,receiver,tag,size)
167 const Int I_ZERO = 0;
169 const Int I_MINUS_ONE = -1;
170 const Real D_ZERO = 0.0;
171 const Real D_ONE = 1.0;
172 const Real D_MINUS_ONE = -1.0;
173 const Complex Z_ZERO = Complex(0.0, 0.0);
174 const Complex Z_ONE = Complex(1.0, 0.0);
175 const Complex Z_MINUS_ONE = Complex(-1.0, 0.0);
176 const Complex Z_I = Complex(0.0, 1.0);
177 const Complex Z_MINUS_I = Complex(0.0, -1.0);
178 const Scalar SCALAR_ZERO =
static_cast<Scalar
>(0.0);
179 const Scalar SCALAR_ONE =
static_cast<Scalar
>(1.0);
180 const Scalar SCALAR_MINUS_ONE =
static_cast<Scalar
>(-1.0);
183 const T ZERO(){
return static_cast<T
>(0.0);};
185 const T ONE(){
return static_cast<T
>(1.0);};
187 const T MINUS_ONE(){
return static_cast<T
>(-1.0);};
189 const char UPPER =
'U';
190 const char LOWER =
'L';
194 const Real au2K = 315774.67;
195 const Real PI = 3.141592653589793;
210 inline void gdb_lock(){
211 volatile int lock = 1;
212 statusOFS<<
"LOCKED"<<std::endl;
223 void PushCallStack( std::string s );
225 void DumpCallStack();
226 #endif // ifndef _RELEASE_
235 Int overflow( Int c ) {
return traits_type::not_eof(c); }
239 : std::ios(&nullStreamBuffer_), std::ostream(&nullStreamBuffer_)
251 int nSize = backtrace(array, 25);
252 char ** symbols = backtrace_symbols(array, nSize);
254 for (
int i = 0; i < nSize; i++)
256 std::cout << symbols[i] << std::endl;
268 inline Int iround(Real a){
270 if(a>0) b = (a-Int(a)<0.5)?Int(a):(Int(a)+1);
271 else b = (Int(a)-a<0.5)?Int(a):(Int(a)-1);
276 inline void OptionsCreate(Int argc,
char** argv, std::map<std::string,std::string>& options){
278 for(Int k=1; k<argc; k=k+2) {
279 options[ std::string(argv[k]) ] = std::string(argv[k+1]);
285 inline Int Size( std::stringstream& sstm ){
287 sstm.seekg (0, std::ios::end);
288 length = sstm.tellg();
289 sstm.seekg (0, std::ios::beg);
297 #endif // _PEXSI_ENVIRONMENT_HPP_
Definition: environment.hpp:233
Definition: environment.hpp:245
Definition: environment.hpp:231