H2Lib
3.0
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
Library
clsettings.h
Go to the documentation of this file.
1
/* ------------------------------------------------------------
2
This is the file "clsettings.h" of the H2Lib package.
3
All rights reserved, Sven Christophersen 2015
4
------------------------------------------------------------ */
5
12
#ifndef CLSETTINGS_H_
13
#define CLSETTINGS_H_
14
22
const
char
clsettings_src
[] = {
"\n"
23
"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n"
24
"\n"
25
"#if USE_OPENCL\n"
26
"/** @cond DEBUG */\n"
27
"#define OCL_SYNTAX_HIGHLIGHT 1\n"
28
"/** @endcond */\n"
29
"#endif\n"
30
"\n"
31
"#if OCL_SYNTAX_HIGHLIGHT\n"
32
"/** @cond DEBUG */\n"
33
"#define __kernel\n"
34
"#define __global\n"
35
"#define __local\n"
36
"#define __constant\n"
37
"/** @endcond */\n"
38
"#endif\n"
39
"\n"
40
"/** @brief @ref real floating point type.\n"
41
" *\n"
42
" * This type is used, e.g., for geometric coordinates, norms\n"
43
" * and diagonal elements of self-adjoint matrices. */\n"
44
"#ifdef USE_FLOAT\n"
45
"typedef float real;\n"
46
"#else\n"
47
"typedef double real;\n"
48
"#endif\n"
49
"\n"
50
"/** @brief Field type.\n"
51
" *\n"
52
" * This type is used in the linear algebra modules to represent\n"
53
" * the coefficients of matrices and vectors. */\n"
54
"#ifdef USE_FLOAT\n"
55
"#ifdef USE_COMPLEX\n"
56
"typedef float2 field;\n"
57
"#else\n"
58
"typedef float field;\n"
59
"#endif\n"
60
"#else\n"
61
"#ifdef USE_COMPLEX\n"
62
"typedef double2 field;\n"
63
"#else\n"
64
"typedef double field;\n"
65
"#endif\n"
66
"#endif\n"
67
"\n"
68
"/** @brief Define the imaginary unit. */\n"
69
"#ifdef USE_FLOAT\n"
70
"#ifdef USE_COMPLEX\n"
71
"#define I ((field)(0.0f,1.0f))\n"
72
"#else\n"
73
"\n"
74
"#endif\n"
75
"#else\n"
76
"#ifdef USE_COMPLEX\n"
77
"#define I ((field)(0.0,1.0))\n"
78
"#else\n"
79
"#endif\n"
80
"#endif\n"
81
"\n"
82
"/** @brief @ref real constant zero */\n"
83
"__constant static real r_zero;\n"
84
"\n"
85
"/** @brief @ref real constant one */\n"
86
"__constant static real r_one;\n"
87
"\n"
88
"/** @brief @ref real constant minus one */\n"
89
"__constant static real r_minusone;\n"
90
"\n"
91
"/** @brief @ref real constant two */\n"
92
"__constant static real r_two;\n"
93
"\n"
94
"/** @brief @ref field constant zero */\n"
95
"__constant static field f_zero;\n"
96
"\n"
97
"/** @brief @ref field constant one */\n"
98
"__constant static field f_one;\n"
99
"\n"
100
"/** @brief @ref field constant minus one */\n"
101
"__constant static field f_minusone;\n"
102
"\n"
103
"#ifdef USE_FLOAT\n"
104
"__constant static real r_zero = 0.0f;\n"
105
"__constant static real r_one = 1.0f;\n"
106
"__constant static real r_minusone = -1.0f;\n"
107
"__constant static real r_two = 2.0f;\n"
108
"\n"
109
"#ifdef USE_COMPLEX\n"
110
"__constant static field f_zero = (field) (0.0f,0.0f);\n"
111
"__constant static field f_one = (field) (1.0f, 0.0f);\n"
112
"__constant static field f_minusone = (field) (-1.0f, 0.0f);\n"
113
"#else\n"
114
"__constant static field f_zero = 0.0f;\n"
115
"__constant static field f_one = 1.0f;\n"
116
"__constant static field f_minusone = -1.0f;\n"
117
"#endif\n"
118
"#else\n"
119
"__constant static real r_zero = 0.0;\n"
120
"__constant static real r_one = 1.0;\n"
121
"__constant static real r_minusone = -1.0;\n"
122
"__constant static real r_two = 2.0;\n"
123
"\n"
124
"#ifdef USE_COMPLEX\n"
125
"__constant static field f_zero = (field) (0.0, 0.0);\n"
126
"__constant static field f_one = (field) (1.0, 0.0);\n"
127
"__constant static field f_minusone = (field) (-1.0, 0.0);\n"
128
"#else\n"
129
"__constant static field f_zero = 0.0;\n"
130
"__constant static field f_one = 1.0;\n"
131
"__constant static field f_minusone = -1.0;\n"
132
"#endif\n"
133
"#endif\n"
134
"\n"
135
"/****************************************************\n"
136
" * basis operations on complex numbers\n"
137
" ****************************************************/\n"
138
"\n"
139
"#ifdef USE_COMPLEX\n"
140
"/**\n"
141
" * @brief Returns the real part of a complex number z.\n"
142
" *\n"
143
" * @param z Complex number given by z = a + b * I\n"
144
" * @return Real part of z: Re(z) = a.\n"
145
" */\n"
146
"inline real REAL(field z) {\n"
147
" return z.x;\n"
148
"}\n"
149
"\n"
150
"/**\n"
151
" * @brief Returns the imaginary part of a complex number z.\n"
152
" *\n"
153
" * @param z Complex number given by z = a + b * I\n"
154
" * @return Imaginary part of z: IM(z) = b.\n"
155
" */\n"
156
"inline real IMAG(field z) {\n"
157
" return z.y;\n"
158
"}\n"
159
"\n"
160
"/**\n"
161
" * @brief Performs a complex multiplication of two complex numbers x and y.\n"
162
" *\n"
163
" * @param x 1st factor of the complex product.\n"
164
" * @param y 2nd factor of the complex product.\n"
165
" * @return Returns the product @f$ x \times y@f$.\n"
166
" */\n"
167
"inline field cmul(field x, field y) {\n"
168
" return (field) (x.x * y.x - x.y * y.y, x.x * y.y + x.y * y.x);\n"
169
"}\n"
170
"#else\n"
171
"\n"
172
"#endif\n"
173
};
174
179
#endif
/* CLSETTINGS_H_ */
clsettings_src
const char clsettings_src[]
Definition:
clsettings.h:22
Generated on Thu Jan 26 2017 13:00:37 for H2Lib by
1.8.11