-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
70 lines (59 loc) · 1.75 KB
/
config.h
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
// werner-ng/src/config.h
// This file is a part of 'Werner NG' project.
/** \file config.h
** \brief Declares very common type names and macros.
**
** \author Igor Krivenko ([email protected])
** \author Alexey Rubtsov ([email protected])
** \author Andrey Antipov ([email protected])
*/
#ifndef _CONFIG_H
#define _CONFIG_H
#include <vector>
#include <complex>
#include <iostream>
/** Real floating point type. */
typedef double n_type;
/** Complex type. */
typedef std::complex<n_type> ComplexType;
/** Dense complex matrix. */
//typedef Eigen::Matrix<ComplexType,Eigen::Dynamic,Eigen::Dynamic,Eigen::AutoAlign> MatrixType;
/** Dense real matrix. */
//typedef Eigen::Matrix<n_type,Eigen::Dynamic,Eigen::Dynamic,Eigen::AutoAlign> RealMatrixType;
/** Dense complex vector. */
typedef std::vector<ComplexType> VectorType;
/** Dense real vector. */
typedef std::vector<n_type> RealVectorType;
/** Dense vector of integers. */
typedef std::vector<int> IntVectorType;
/** A short name for imaginary unit. */
static const ComplexType I = ComplexType(0.0,1.0); // 'static' to prevent linking problems
static n_type Pi=4.*atan(n_type(1.0));
/** Generalized 'square' function. */
template<typename T> inline T sqr(T x) { return x*x; }
//@{
/** Do-It-Once environment from A. Rubtsov
**
** When you want a piece of code to run exactly once, just write:
** \verbatim
do_once
... your code goes here...
end_do_once
\endverbatim
**/
#define do_once { static bool done_once=false; if (!done_once) {done_once=true;
#define end_do_once }; };
//@}
// Maybe temporary
using std::cout;
using std::endl;
using std::flush;
using std::complex;
using std::ostream;
using std::ofstream;
using std::ifstream;
using std::ios;
using std::vector;
using std::string;
using std::stringstream;
#endif /* #ifndef _CONFIG_H */