Class documentation of Concepts

Loading...
Searching...
No Matches
typedefs.hh
Go to the documentation of this file.
1
6#ifndef typedefs_hh
7#define typedefs_hh
8
9#define _USE_MATH_DEFINES
10#include <cmath>
11// Define the constant M_PI, if not defined (e.g. with Windows Microsoft C++ compiler)
12#ifndef M_PI
13#define M_PI 3.14159265358979323846264338327
14#endif
15
16// Define the epsilon machine, i.e. the difference between 1 and the next representable value of double type
17#if __GNUC__ == 2
18# include <float.h>
19# define EPS DBL_EPSILON
20#else
21# include <limits>
22# define EPS std::numeric_limits<double>::epsilon()
23#endif
24
25#if __GNUC__ >= 9
26#include <stddef.h>
27#endif
28#include <sys/types.h>
29#include <string>
30#include <complex>
31
32namespace concepts {
33
39 typedef double Real;
40
42 typedef std::complex<Real> Cmplx;
43
45 typedef signed int sint;
46
48 typedef unsigned char uchar;
49
51 typedef unsigned short ushort;
52
53 // **************************************************************** number **
54
70 template<typename F>
71 struct number {};
72
74 template<>
75 struct number<double> {
76 static inline std::string name() { return "double"; }
77 };
78
80 template<>
81 struct number<long double> {
82 static inline std::string name() { return "long double"; }
83 };
84
86 template<>
87 struct number<std::complex<double> > {
88 static inline std::string name() { return "complex<double>"; }
89 };
90
92 template<>
93 struct number<std::complex<long double> > {
94 static inline std::string name() { return "complex<long double>"; }
95 };
96
97 // ************************************************************** Realtype **
98
102 template<typename F>
103 struct Realtype {
104 typedef F type;
105 };
106
107 template<typename F>
108 struct Realtype<std::complex<F> > {
109 typedef F type;
110 };
111
112 // ************************************************************* Cmplxtype **
113
117 template<typename F>
118 struct Cmplxtype {
119 typedef std::complex<F> type;
120 };
121
122 template<typename F>
123 struct Cmplxtype<std::complex<F> > {
124 typedef std::complex<F> type;
125 };
126
127 // ************************************************************** Combtype **
128
137 template<typename F, typename G>
138 struct Combtype {
139 typedef F type;
140 };
141
145 template<typename F>
146 struct Combtype<std::complex<F>, F> {
147 typedef std::complex<F> type;
148 };
149
153 template<typename F>
154 struct Combtype<F, std::complex<F> > {
155 typedef std::complex<F> type;
156 };
157
162 template<typename F>
163 struct Combtype<int, F> {
164 typedef F type;
165 };
166
171 template<typename F>
172 struct Combtype<F, int> {
173 typedef F type;
174 };
175
176 // ************************************************************** Datatype **
177
180 template<typename F>
181 struct Datatype {
182 typedef F type;
183 };
184
185} // namespace concepts
186
187#endif // typedefs_hh
signed int sint
Abbreviation for signed int.
Definition typedefs.hh:45
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
unsigned short ushort
Abbreviation for unsigned short.
Definition typedefs.hh:51
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition typedefs.hh:42
unsigned char uchar
Abbreviation for unsigned char.
Definition typedefs.hh:48