TBCI Numerical high perf. C++ Library  2.8.0
plain_def.h
Go to the documentation of this file.
1 
7 #ifndef TBCI_PLAIN_DEF_H
8 #define TBCI_PLAIN_DEF_H
9 
10 //#include "basics.h"
11 
13 #define LCTYPE(T) REGISTER typename tbci_traits<T>::loop_const_refval_type
14 #define LCTYPED(T) REGISTER tbci_traits<T>::loop_const_refval_type
15 
20 #define VKERN_TEMPL_3V(FNAME,OP3) \
22 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
23  (const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
24  const T* RESTRICT const);) \
25 template <typename T> \
26 VEC_INLINE void FNAME (const unsigned long sz, \
27  T* RESTRICT const res, \
28  const T* RESTRICT const v1, \
29  const T* RESTRICT const v2) \
30 { \
31  REGISTER unsigned long i; \
32  OMP_FOR for (i = 0; i < sz; ++i) \
33  OP3(res[i], v1[i], v2[i], f1, f2); \
34 }
35 
37 #define VKERN_TEMPL_3V_C(FNAME,OP3) \
38 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
39  (const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
40  const T* RESTRICT const, LCTYPED(T));) \
41 template <typename T> \
42 VEC_INLINE void FNAME (const unsigned long sz, \
43  T* RESTRICT const res, \
44  const T* RESTRICT const v1, \
45  const T* RESTRICT const v2, \
46  LCTYPE(T) f2) \
47 { \
48  REGISTER unsigned long i; \
49  OMP_FOR for (i = 0; i < sz; ++i) \
50  OP3(res[i], v1[i], v2[i], f1, f2); \
51 }
52 
54 #define VKERN_TEMPL_3V_CC(FNAME,OP3) \
55 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
56  (const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
57  const T* RESTRICT const, LCTYPED(T), LCTYPED(T));) \
58 template <typename T> \
59 VEC_INLINE void FNAME (const unsigned long sz, \
60  T* RESTRICT const res, \
61  const T* RESTRICT const v1, \
62  const T* RESTRICT const v2, \
63  LCTYPE(T) f1, \
64  LCTYPE(T) f2) \
65 { \
66  REGISTER unsigned long i; \
67  OMP_FOR for (i = 0; i < sz; ++i) \
68  OP3(res[i], v1[i], v2[i], f1, f2); \
69 }
70 
72 #define VKERN_TEMPL_2V(FNAME,OP2) \
73 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
74  (const unsigned long, T* RESTRICT const, const T* RESTRICT const);) \
75 template <typename T> \
76 VEC_INLINE void FNAME (const unsigned long sz, \
77  T* RESTRICT const res, \
78  const T* RESTRICT const v1) \
79 { \
80  REGISTER unsigned long i; \
81  OMP_FOR for (i = 0; i < sz; ++i) \
82  OP2(res[i], v1[i], f1, f2); \
83 }
84 
86 #define VKERN_TEMPL_2V_C(FNAME,OP2) \
87 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
88  (const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
89  LCTYPED(T));) \
90 template <typename T> \
91 VEC_INLINE void FNAME (const unsigned long sz, \
92  T* RESTRICT const res, \
93  const T* RESTRICT const v1, \
94  LCTYPE(T) f2) \
95 { \
96  REGISTER unsigned long i; \
97  OMP_FOR for (i = 0; i < sz; ++i) \
98  OP2(res[i], v1[i], f1, f2); \
99 }
100 
102 #define VKERN_TEMPL_2V_CC(FNAME,OP2) \
103 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
104  (const unsigned long, T* RESTRICT const, const T* RESTRICT const, \
105  LCTYPED(T), LCTYPED(T));) \
106 template <typename T> \
107 VEC_INLINE void FNAME (const unsigned long sz, \
108  T* RESTRICT const res, \
109  const T* RESTRICT const v1, \
110  LCTYPE(T) f1, \
111  LCTYPE(T) f2) \
112 { \
113  REGISTER unsigned long i; \
114  OMP_FOR for (i = 0; i < sz; ++i) \
115  OP2(res[i], v1[i], f1, f2); \
116 }
117 
119 #define VKERN_TEMPL_2V_T(FNAME,OP2,TYPE) \
120 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
121  (const unsigned long, const T* RESTRICT const, \
122  const T* RESTRICT const, TYPE&);) \
123 template <typename T> \
124 VEC_INLINE void FNAME (const unsigned long sz, \
125  const T* RESTRICT const v1, \
126  const T* RESTRICT const v2, \
127  TYPE &_f2) \
128 { \
129  /* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
130  REGISTER TYPE f2(_f2), f1(0.0); \
131  REGISTER unsigned long i; \
132  OMP_FOR_REDUCE_F1F2 for (i = 0; i < sz; ++i) \
133  OP2(v1[i], v2[i], f1, f2); \
134  _fin: \
135  _f2 = f2 - f1; \
136 }
137 
139 #define VKERN_TEMPL_2V_T_STRIDE(FNAME,OP2,TYPE) \
140 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
141  (const unsigned long, const T* RESTRICT const, \
142  const T* RESTRICT const, TYPE&, const unsigned);) \
143 template <typename T> \
144 VEC_INLINE void FNAME (const unsigned long sz, \
145  const T* RESTRICT const v1, \
146  const T* RESTRICT const v2, \
147  TYPE &_f2, const unsigned rincr) \
148 { \
149  /* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
150  REGISTER TYPE f2(_f2), f1(0.0); \
151  REGISTER unsigned long i; \
152  OMP_FOR_REDUCE_F1F2 for (i = 0; i < sz; ++i) \
153  OP2(v1[i*rincr], v2[i], f1, f2); \
154  _fin: \
155  _f2 = f2 - f1; \
156 }
157 
159 #define VKERN_TEMPL_1V(FNAME,OP1) \
160 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
161  (const unsigned long, T* RESTRICT const);) \
162 template <typename T> \
163 VEC_INLINE void FNAME (const unsigned long sz, \
164  T* RESTRICT const res) \
165 { \
166  REGISTER unsigned long i; \
167  OMP_FOR for (i = 0; i < sz; ++i) \
168  OP1(res[i], f1, f2); \
169 }
170 
172 #define VKERN_TEMPL_1V_C(FNAME,OP1) \
173 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
174  (const unsigned long, T* RESTRICT const, LCTYPED(T));) \
175 template <typename T> \
176 VEC_INLINE void FNAME (const unsigned long sz, \
177  T* RESTRICT const res, \
178  LCTYPE(T) f2) \
179 { \
180  REGISTER unsigned long i; \
181  for (i = 0; i < sz; ++i) \
182  OP1(res[i], f1, f2); \
183 }
184 
186 #define VKERN_TEMPL_1V_CC(FNAME,OP1) \
187 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
188  (const unsigned long, T* RESTRICT const, \
189  LCTYPED(T), LCTYPED(T));) \
190 template <typename T> \
191 VEC_INLINE void FNAME (const unsigned long sz, \
192  T* RESTRICT const res, \
193  LCTYPE(T) f1, \
194  LCTYPE(T) f2) \
195 { \
196  REGISTER unsigned long i; \
197  OMP_FOR for (i = 0; i < sz; ++i) \
198  OP1(res[i], f1, f2); \
199 }
200 
202 #define VKERN_TEMPL_1V_T(FNAME,OP1,TYPE) \
203 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
204  (const unsigned long, const T*, TYPE&);) \
205 template <typename T> \
206 VEC_INLINE void FNAME (const unsigned long sz, \
207  const T* res, \
208  TYPE &_f2) \
209 { \
210  /* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
211  REGISTER TYPE f2(_f2), f1(0.0); \
212  REGISTER unsigned long i; \
213  OMP_FOR_REDUCE_F1F2 for (i = 0; i < sz; ++i) \
214  OP1(res[i], f1, f2); \
215  _f2 = f2 - f1; \
216 }
217 
219 #define VKERN_TEMPL_1V_T_LD(FNAME,OP1,TYPE) \
220 INST(template <typename T> class Vector<T> friend VEC_INLINE void FNAME \
221  (const unsigned long, const T*, TYPE&);) \
222 template <typename T> \
223 VEC_INLINE void FNAME (const unsigned long sz, \
224  const T* res, \
225  TYPE &_f2) \
226 { \
227  /* REGISTER typename tbci_traits<TYPE>::loop_refval_type f2(_f2); */ \
228  REGISTER LONG_DOUBLE f2(_f2); \
229  REGISTER unsigned long i; \
230  OMP_FOR_REDUCE_F2 for (i = 0; i < sz; ++i) \
231  OP1(res[i], f1, f2); \
232  _f2 = f2; \
233 }
234 
235 
236 #endif /* TBCI_PLAIN_DEF_H */