ViennaCL - The Vienna Computing Library: viennacl/scheduler/forwards.h Source File

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
forwards.h
Go to the documentation of this file.
1 #ifndef VIENNACL_SCHEDULER_STATEMENT_HPP
2 #define VIENNACL_SCHEDULER_STATEMENT_HPP
3
4 /* =========================================================================
5 Copyright (c) 2010-2016, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8 Portions of this software are copyright by UChicago Argonne, LLC.
9
10 -----------------
11 ViennaCL - The Vienna Computing Library
12 -----------------
13
14 Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15
16 (A list of authors and contributors can be found in the manual)
17
18 License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20
21
26 #include "viennacl/meta/enable_if.hpp"
27 #include "viennacl/meta/predicate.hpp"
28 #include "viennacl/forwards.h"
29
30 #include <vector>
31
32 namespace viennacl
33 {
34 namespace scheduler
35 {
36
38 class statement_not_supported_exception : public std::exception
39 {
40 public:
41 statement_not_supported_exception() : message_() {}
42 statement_not_supported_exception(std::string message) : message_("ViennaCL: Internal error: The scheduler encountered a problem with the operation provided: " + message) {}
43
44 virtual const char* what() const throw() { return message_.c_str(); }
45
46 virtual ~statement_not_supported_exception() throw() {}
47 private:
48 std::string message_;
49 };
50
51
53 enum operation_node_type_family
54 {
55 OPERATION_INVALID_TYPE_FAMILY = 0,
56
57 // unary or binary expression
58 OPERATION_UNARY_TYPE_FAMILY,
59 OPERATION_BINARY_TYPE_FAMILY,
60
61 //reductions
62 OPERATION_VECTOR_REDUCTION_TYPE_FAMILY,
63 OPERATION_ROWS_REDUCTION_TYPE_FAMILY,
64 OPERATION_COLUMNS_REDUCTION_TYPE_FAMILY
65 };
66
68 enum operation_node_type
69 {
70 OPERATION_INVALID_TYPE = 0,
71
72 // unary operator
73 OPERATION_UNARY_MINUS_TYPE,
74
75 // unary expression
76 OPERATION_UNARY_CAST_CHAR_TYPE,
77 OPERATION_UNARY_CAST_UCHAR_TYPE,
78 OPERATION_UNARY_CAST_SHORT_TYPE,
79 OPERATION_UNARY_CAST_USHORT_TYPE,
80 OPERATION_UNARY_CAST_INT_TYPE,
81 OPERATION_UNARY_CAST_UINT_TYPE,
82 OPERATION_UNARY_CAST_LONG_TYPE,
83 OPERATION_UNARY_CAST_ULONG_TYPE,
84 OPERATION_UNARY_CAST_HALF_TYPE,
85 OPERATION_UNARY_CAST_FLOAT_TYPE,
86 OPERATION_UNARY_CAST_DOUBLE_TYPE,
87
88 OPERATION_UNARY_ABS_TYPE,
89 OPERATION_UNARY_ACOS_TYPE,
90 OPERATION_UNARY_ASIN_TYPE,
91 OPERATION_UNARY_ATAN_TYPE,
92 OPERATION_UNARY_CEIL_TYPE,
93 OPERATION_UNARY_COS_TYPE,
94 OPERATION_UNARY_COSH_TYPE,
95 OPERATION_UNARY_EXP_TYPE,
96 OPERATION_UNARY_FABS_TYPE,
97 OPERATION_UNARY_FLOOR_TYPE,
98 OPERATION_UNARY_LOG_TYPE,
99 OPERATION_UNARY_LOG10_TYPE,
100 OPERATION_UNARY_SIN_TYPE,
101 OPERATION_UNARY_SINH_TYPE,
102 OPERATION_UNARY_SQRT_TYPE,
103 OPERATION_UNARY_TAN_TYPE,
104 OPERATION_UNARY_TANH_TYPE,
105
106 OPERATION_UNARY_TRANS_TYPE,
107 OPERATION_UNARY_NORM_1_TYPE,
108 OPERATION_UNARY_NORM_2_TYPE,
109 OPERATION_UNARY_NORM_INF_TYPE,
110 OPERATION_UNARY_MAX_TYPE,
111 OPERATION_UNARY_MIN_TYPE,
112
113 // binary expression
114 OPERATION_BINARY_ACCESS_TYPE,
115 OPERATION_BINARY_ASSIGN_TYPE,
116 OPERATION_BINARY_INPLACE_ADD_TYPE,
117 OPERATION_BINARY_INPLACE_SUB_TYPE,
118 OPERATION_BINARY_ADD_TYPE,
119 OPERATION_BINARY_SUB_TYPE,
120 OPERATION_BINARY_MULT_TYPE, // scalar times vector/matrix
121 OPERATION_BINARY_DIV_TYPE, // vector/matrix divided by scalar
122 OPERATION_BINARY_ELEMENT_ARGFMAX_TYPE,
123 OPERATION_BINARY_ELEMENT_ARGFMIN_TYPE,
124 OPERATION_BINARY_ELEMENT_ARGMAX_TYPE,
125 OPERATION_BINARY_ELEMENT_ARGMIN_TYPE,
126 OPERATION_BINARY_ELEMENT_PROD_TYPE,
127 OPERATION_BINARY_ELEMENT_DIV_TYPE,
128 OPERATION_BINARY_ELEMENT_EQ_TYPE,
129 OPERATION_BINARY_ELEMENT_NEQ_TYPE,
130 OPERATION_BINARY_ELEMENT_GREATER_TYPE,
131 OPERATION_BINARY_ELEMENT_GEQ_TYPE,
132 OPERATION_BINARY_ELEMENT_LESS_TYPE,
133 OPERATION_BINARY_ELEMENT_LEQ_TYPE,
134 OPERATION_BINARY_ELEMENT_POW_TYPE,
135 OPERATION_BINARY_ELEMENT_FMAX_TYPE,
136 OPERATION_BINARY_ELEMENT_FMIN_TYPE,
137 OPERATION_BINARY_ELEMENT_MAX_TYPE,
138 OPERATION_BINARY_ELEMENT_MIN_TYPE,
139
140 OPERATION_BINARY_MATRIX_DIAG_TYPE,
141 OPERATION_BINARY_VECTOR_DIAG_TYPE,
142 OPERATION_BINARY_MATRIX_ROW_TYPE,
143 OPERATION_BINARY_MATRIX_COLUMN_TYPE,
144 OPERATION_BINARY_MAT_VEC_PROD_TYPE,
145 OPERATION_BINARY_MAT_MAT_PROD_TYPE,
146 OPERATION_BINARY_INNER_PROD_TYPE
147
148 };
149
150
151
152 namespace result_of
153 {
155 template<typename T>
156 struct op_type_info
157 {
158 typedef typename T::ERROR_UNKNOWN_OP_TYPE error_type;
159 };
160
162 // elementwise casts
163 template<> struct op_type_info<op_element_cast<char> > { enum { id = OPERATION_UNARY_CAST_CHAR_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
164 template<> struct op_type_info<op_element_cast<unsigned char> > { enum { id = OPERATION_UNARY_CAST_UCHAR_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
165 template<> struct op_type_info<op_element_cast<short> > { enum { id = OPERATION_UNARY_CAST_SHORT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
166 template<> struct op_type_info<op_element_cast<unsigned short> > { enum { id = OPERATION_UNARY_CAST_USHORT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
167 template<> struct op_type_info<op_element_cast<int> > { enum { id = OPERATION_UNARY_CAST_INT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
168 template<> struct op_type_info<op_element_cast<unsigned int> > { enum { id = OPERATION_UNARY_CAST_UINT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
169 template<> struct op_type_info<op_element_cast<long> > { enum { id = OPERATION_UNARY_CAST_LONG_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
170 template<> struct op_type_info<op_element_cast<unsigned long> > { enum { id = OPERATION_UNARY_CAST_ULONG_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
171 template<> struct op_type_info<op_element_cast<float> > { enum { id = OPERATION_UNARY_CAST_FLOAT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
172 template<> struct op_type_info<op_element_cast<double> > { enum { id = OPERATION_UNARY_CAST_DOUBLE_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
173
174 // elementwise functions
175 template<> struct op_type_info<op_element_unary<op_abs> > { enum { id = OPERATION_UNARY_ABS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
176 template<> struct op_type_info<op_element_unary<op_acos> > { enum { id = OPERATION_UNARY_ACOS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
177 template<> struct op_type_info<op_element_unary<op_asin> > { enum { id = OPERATION_UNARY_ASIN_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
178 template<> struct op_type_info<op_element_unary<op_atan> > { enum { id = OPERATION_UNARY_ATAN_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
179 template<> struct op_type_info<op_element_unary<op_ceil> > { enum { id = OPERATION_UNARY_CEIL_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
180 template<> struct op_type_info<op_element_unary<op_cos> > { enum { id = OPERATION_UNARY_COS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
181 template<> struct op_type_info<op_element_unary<op_cosh> > { enum { id = OPERATION_UNARY_COSH_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
182 template<> struct op_type_info<op_element_unary<op_exp> > { enum { id = OPERATION_UNARY_EXP_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
183 template<> struct op_type_info<op_element_unary<op_fabs> > { enum { id = OPERATION_UNARY_FABS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
184 template<> struct op_type_info<op_element_unary<op_floor> > { enum { id = OPERATION_UNARY_FLOOR_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
185 template<> struct op_type_info<op_element_unary<op_log> > { enum { id = OPERATION_UNARY_LOG_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
186 template<> struct op_type_info<op_element_unary<op_log10> > { enum { id = OPERATION_UNARY_LOG10_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
187 template<> struct op_type_info<op_element_unary<op_sin> > { enum { id = OPERATION_UNARY_SIN_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
188 template<> struct op_type_info<op_element_unary<op_sinh> > { enum { id = OPERATION_UNARY_SINH_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
189 template<> struct op_type_info<op_element_unary<op_sqrt> > { enum { id = OPERATION_UNARY_SQRT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
190 template<> struct op_type_info<op_element_unary<op_tan> > { enum { id = OPERATION_UNARY_TAN_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
191 template<> struct op_type_info<op_element_unary<op_tanh> > { enum { id = OPERATION_UNARY_TANH_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
192
193 template<> struct op_type_info<op_element_binary<op_argmax> > { enum { id = OPERATION_BINARY_ELEMENT_ARGMAX_TYPE , family = OPERATION_BINARY_TYPE_FAMILY}; };
194 template<> struct op_type_info<op_element_binary<op_argmin> > { enum { id = OPERATION_BINARY_ELEMENT_ARGMIN_TYPE , family = OPERATION_BINARY_TYPE_FAMILY}; };
195 template<> struct op_type_info<op_element_binary<op_pow> > { enum { id = OPERATION_BINARY_ELEMENT_POW_TYPE , family = OPERATION_BINARY_TYPE_FAMILY}; };
196 template<> struct op_type_info<op_element_binary<op_eq> > { enum { id = OPERATION_BINARY_ELEMENT_EQ_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
197 template<> struct op_type_info<op_element_binary<op_neq> > { enum { id = OPERATION_BINARY_ELEMENT_NEQ_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
198 template<> struct op_type_info<op_element_binary<op_greater> > { enum { id = OPERATION_BINARY_ELEMENT_GREATER_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
199 template<> struct op_type_info<op_element_binary<op_less> > { enum { id = OPERATION_BINARY_ELEMENT_LESS_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
200 template<> struct op_type_info<op_element_binary<op_geq> > { enum { id = OPERATION_BINARY_ELEMENT_GEQ_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
201 template<> struct op_type_info<op_element_binary<op_leq> > { enum { id = OPERATION_BINARY_ELEMENT_LEQ_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
202 template<> struct op_type_info<op_element_binary<op_fmax> > { enum { id = OPERATION_BINARY_ELEMENT_FMAX_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
203 template<> struct op_type_info<op_element_binary<op_fmin> > { enum { id = OPERATION_BINARY_ELEMENT_FMIN_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
204
205
206 //structurewise function
207 template<> struct op_type_info<op_norm_1 > { enum { id = OPERATION_UNARY_NORM_1_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
208 template<> struct op_type_info<op_norm_2 > { enum { id = OPERATION_UNARY_NORM_2_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
209 template<> struct op_type_info<op_norm_inf > { enum { id = OPERATION_UNARY_NORM_INF_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
210 template<> struct op_type_info<op_max > { enum { id = OPERATION_UNARY_MAX_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
211 template<> struct op_type_info<op_min > { enum { id = OPERATION_UNARY_MIN_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
212
213 template<> struct op_type_info<op_trans > { enum { id = OPERATION_UNARY_TRANS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
214 template<> struct op_type_info<op_row > { enum { id = OPERATION_BINARY_MATRIX_ROW_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
215 template<> struct op_type_info<op_column > { enum { id = OPERATION_BINARY_MATRIX_COLUMN_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
216
217 template<> struct op_type_info<op_matrix_diag> { enum { id = OPERATION_BINARY_MATRIX_DIAG_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
218 template<> struct op_type_info<op_vector_diag> { enum { id = OPERATION_BINARY_VECTOR_DIAG_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
219
220 template<> struct op_type_info<op_prod> { enum { id = OPERATION_BINARY_MAT_VEC_PROD_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
221 template<> struct op_type_info<op_mat_mat_prod> { enum { id = OPERATION_BINARY_MAT_MAT_PROD_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
222 template<> struct op_type_info<op_inner_prod> { enum { id = OPERATION_BINARY_INNER_PROD_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
223
224 //elementwise operator
225 template<> struct op_type_info<op_assign> { enum { id = OPERATION_BINARY_ASSIGN_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
226 template<> struct op_type_info<op_inplace_add> { enum { id = OPERATION_BINARY_INPLACE_ADD_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
227 template<> struct op_type_info<op_inplace_sub> { enum { id = OPERATION_BINARY_INPLACE_SUB_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
228 template<> struct op_type_info<op_add> { enum { id = OPERATION_BINARY_ADD_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
229 template<> struct op_type_info<op_sub> { enum { id = OPERATION_BINARY_SUB_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
230 template<> struct op_type_info<op_element_binary<op_prod> > { enum { id = OPERATION_BINARY_ELEMENT_PROD_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
231 template<> struct op_type_info<op_element_binary<op_div> > { enum { id = OPERATION_BINARY_ELEMENT_DIV_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
232 template<> struct op_type_info<op_mult> { enum { id = OPERATION_BINARY_MULT_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
233 template<> struct op_type_info<op_div> { enum { id = OPERATION_BINARY_DIV_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
234
235 template<> struct op_type_info<op_flip_sign> { enum { id = OPERATION_UNARY_MINUS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
236
237
239 } // namespace result_of
240
241
242
243
244
246 enum statement_node_type_family
247 {
248 INVALID_TYPE_FAMILY = 0,
249
250 // LHS or RHS are again an expression:
251 COMPOSITE_OPERATION_FAMILY,
252
253 // device scalars:
254 SCALAR_TYPE_FAMILY,
255
256 // vector:
257 VECTOR_TYPE_FAMILY,
258
259 // matrices:
260 MATRIX_TYPE_FAMILY
261 };
262
264 enum statement_node_subtype
265 {
266 INVALID_SUBTYPE = 0, //when type is COMPOSITE_OPERATION_FAMILY
267
268 HOST_SCALAR_TYPE,
269 DEVICE_SCALAR_TYPE,
270
271 DENSE_VECTOR_TYPE,
272 IMPLICIT_VECTOR_TYPE,
273
274 DENSE_MATRIX_TYPE,
275 IMPLICIT_MATRIX_TYPE,
276
277 COMPRESSED_MATRIX_TYPE,
278 COORDINATE_MATRIX_TYPE,
279 ELL_MATRIX_TYPE,
280 HYB_MATRIX_TYPE
281
282 // other matrix types to be added here
283 };
284
286 enum statement_node_numeric_type
287 {
288 INVALID_NUMERIC_TYPE = 0, //when type is COMPOSITE_OPERATION_FAMILY
289
290 CHAR_TYPE,
291 UCHAR_TYPE,
292 SHORT_TYPE,
293 USHORT_TYPE,
294 INT_TYPE,
295 UINT_TYPE,
296 LONG_TYPE,
297 ULONG_TYPE,
298 HALF_TYPE,
299 FLOAT_TYPE,
300 DOUBLE_TYPE
301 };
302
303
304 namespace result_of
305 {
307
309 template<typename T>
310 struct numeric_type_id {};
311
314 template<> struct numeric_type_id<char> { enum { value = CHAR_TYPE }; };
315 template<> struct numeric_type_id<unsigned char> { enum { value = UCHAR_TYPE }; };
316 template<> struct numeric_type_id<short> { enum { value = SHORT_TYPE }; };
317 template<> struct numeric_type_id<unsigned short> { enum { value = USHORT_TYPE }; };
318 template<> struct numeric_type_id<int> { enum { value = INT_TYPE }; };
319 template<> struct numeric_type_id<unsigned int> { enum { value = UINT_TYPE }; };
320 template<> struct numeric_type_id<long> { enum { value = LONG_TYPE }; };
321 template<> struct numeric_type_id<unsigned long> { enum { value = ULONG_TYPE }; };
322 template<> struct numeric_type_id<float> { enum { value = FLOAT_TYPE }; };
323 template<> struct numeric_type_id<double> { enum { value = DOUBLE_TYPE }; };
324
326 }
327
328
329
337 struct lhs_rhs_element
338 {
339 statement_node_type_family type_family;
340 statement_node_subtype subtype;
341 statement_node_numeric_type numeric_type;
342
343 union
344 {
346 vcl_size_t node_index;
347
349
350 // host scalars:
351 char host_char;
352 unsigned char host_uchar;
353 short host_short;
354 unsigned short host_ushort;
355 int host_int;
356 unsigned int host_uint;
357 long host_long;
358 unsigned long host_ulong;
359 float host_float;
360 double host_double;
361
362 // Note: ViennaCL types have potentially expensive copy-CTORs, hence using pointers:
363
364 // scalars:
365 viennacl::scalar<char> *scalar_char;
366 viennacl::scalar<unsigned char> *scalar_uchar;
367 viennacl::scalar<short> *scalar_short;
368 viennacl::scalar<unsigned short> *scalar_ushort;
369 viennacl::scalar<int> *scalar_int;
370 viennacl::scalar<unsigned int> *scalar_uint;
371 viennacl::scalar<long> *scalar_long;
372 viennacl::scalar<unsigned long> *scalar_ulong;
373 viennacl::scalar<float> *scalar_float;
374 viennacl::scalar<double> *scalar_double;
375
376 // vectors:
377 viennacl::vector_base<char> *vector_char;
378 viennacl::vector_base<unsigned char> *vector_uchar;
379 viennacl::vector_base<short> *vector_short;
380 viennacl::vector_base<unsigned short> *vector_ushort;
381 viennacl::vector_base<int> *vector_int;
382 viennacl::vector_base<unsigned int> *vector_uint;
383 viennacl::vector_base<long> *vector_long;
384 viennacl::vector_base<unsigned long> *vector_ulong;
385 viennacl::vector_base<float> *vector_float;
386 viennacl::vector_base<double> *vector_double;
387
388 // implicit vectors:
389 viennacl::implicit_vector_base<char> *implicit_vector_char;
390 viennacl::implicit_vector_base<unsigned char> *implicit_vector_uchar;
391 viennacl::implicit_vector_base<short> *implicit_vector_short;
392 viennacl::implicit_vector_base<unsigned short> *implicit_vector_ushort;
393 viennacl::implicit_vector_base<int> *implicit_vector_int;
394 viennacl::implicit_vector_base<unsigned int> *implicit_vector_uint;
395 viennacl::implicit_vector_base<long> *implicit_vector_long;
396 viennacl::implicit_vector_base<unsigned long> *implicit_vector_ulong;
397 viennacl::implicit_vector_base<float> *implicit_vector_float;
398 viennacl::implicit_vector_base<double> *implicit_vector_double;
399
400 // dense matrices:
401 viennacl::matrix_base<char> *matrix_char;
402 viennacl::matrix_base<unsigned char> *matrix_uchar;
403 viennacl::matrix_base<short> *matrix_short;
404 viennacl::matrix_base<unsigned short> *matrix_ushort;
405 viennacl::matrix_base<int> *matrix_int;
406 viennacl::matrix_base<unsigned int> *matrix_uint;
407 viennacl::matrix_base<long> *matrix_long;
408 viennacl::matrix_base<unsigned long> *matrix_ulong;
409 viennacl::matrix_base<float> *matrix_float;
410 viennacl::matrix_base<double> *matrix_double;
411
412 viennacl::implicit_matrix_base<char> *implicit_matrix_char;
413 viennacl::implicit_matrix_base<unsigned char> *implicit_matrix_uchar;
414 viennacl::implicit_matrix_base<short> *implicit_matrix_short;
415 viennacl::implicit_matrix_base<unsigned short> *implicit_matrix_ushort;
416 viennacl::implicit_matrix_base<int> *implicit_matrix_int;
417 viennacl::implicit_matrix_base<unsigned int> *implicit_matrix_uint;
418 viennacl::implicit_matrix_base<long> *implicit_matrix_long;
419 viennacl::implicit_matrix_base<unsigned long> *implicit_matrix_ulong;
420 viennacl::implicit_matrix_base<float> *implicit_matrix_float;
421 viennacl::implicit_matrix_base<double> *implicit_matrix_double;
422
423 //viennacl::compressed_matrix<float> *compressed_matrix_char;
424 //viennacl::compressed_matrix<double> *compressed_matrix_uchar;
425 //viennacl::compressed_matrix<float> *compressed_matrix_short;
426 //viennacl::compressed_matrix<double> *compressed_matrix_ushort;
427 //viennacl::compressed_matrix<float> *compressed_matrix_int;
428 //viennacl::compressed_matrix<double> *compressed_matrix_uint;
429 //viennacl::compressed_matrix<float> *compressed_matrix_long;
430 //viennacl::compressed_matrix<double> *compressed_matrix_ulong;
431 viennacl::compressed_matrix<float> *compressed_matrix_float;
432 viennacl::compressed_matrix<double> *compressed_matrix_double;
433
434 //viennacl::coordinate_matrix<float> *coordinate_matrix_char;
435 //viennacl::coordinate_matrix<double> *coordinate_matrix_uchar;
436 //viennacl::coordinate_matrix<float> *coordinate_matrix_short;
437 //viennacl::coordinate_matrix<double> *coordinate_matrix_ushort;
438 //viennacl::coordinate_matrix<float> *coordinate_matrix_int;
439 //viennacl::coordinate_matrix<double> *coordinate_matrix_uint;
440 //viennacl::coordinate_matrix<float> *coordinate_matrix_long;
441 //viennacl::coordinate_matrix<double> *coordinate_matrix_ulong;
442 viennacl::coordinate_matrix<float> *coordinate_matrix_float;
443 viennacl::coordinate_matrix<double> *coordinate_matrix_double;
444
445 //viennacl::ell_matrix<float> *ell_matrix_char;
446 //viennacl::ell_matrix<double> *ell_matrix_uchar;
447 //viennacl::ell_matrix<float> *ell_matrix_short;
448 //viennacl::ell_matrix<double> *ell_matrix_ushort;
449 //viennacl::ell_matrix<float> *ell_matrix_int;
450 //viennacl::ell_matrix<double> *ell_matrix_uint;
451 //viennacl::ell_matrix<float> *ell_matrix_long;
452 //viennacl::ell_matrix<double> *ell_matrix_ulong;
453 viennacl::ell_matrix<float> *ell_matrix_float;
454 viennacl::ell_matrix<double> *ell_matrix_double;
455
456 //viennacl::hyb_matrix<float> *hyb_matrix_char;
457 //viennacl::hyb_matrix<double> *hyb_matrix_uchar;
458 //viennacl::hyb_matrix<float> *hyb_matrix_short;
459 //viennacl::hyb_matrix<double> *hyb_matrix_ushort;
460 //viennacl::hyb_matrix<float> *hyb_matrix_int;
461 //viennacl::hyb_matrix<double> *hyb_matrix_uint;
462 //viennacl::hyb_matrix<float> *hyb_matrix_long;
463 //viennacl::hyb_matrix<double> *hyb_matrix_ulong;
464 viennacl::hyb_matrix<float> *hyb_matrix_float;
465 viennacl::hyb_matrix<double> *hyb_matrix_double;
466 };
467 };
468
469
471 struct op_element
472 {
473 operation_node_type_family type_family;
474 operation_node_type type;
475 };
476
478 struct statement_node
479 {
480 lhs_rhs_element lhs;
481 op_element op;
482 lhs_rhs_element rhs;
483 };
484
485 namespace result_of
486 {
487
488 template<class T> struct num_nodes { enum { value = 0 }; };
489 template<class LHS, class OP, class RHS> struct num_nodes< vector_expression<LHS, RHS, OP> > { enum { value = 1 + num_nodes<LHS>::value + num_nodes<RHS>::value + num_nodes<OP>::value }; };
490 template<class LHS, class OP, class RHS> struct num_nodes< const vector_expression<LHS, RHS, OP> > { enum { value = 1 + num_nodes<LHS>::value + num_nodes<RHS>::value + num_nodes<OP>::value }; };
491 template<class LHS, class OP, class RHS> struct num_nodes< matrix_expression<LHS, RHS, OP> > { enum { value = 1 + num_nodes<LHS>::value + num_nodes<RHS>::value + num_nodes<OP>::value }; };
492 template<class LHS, class OP, class RHS> struct num_nodes< const matrix_expression<LHS, RHS, OP> > { enum { value = 1 + num_nodes<LHS>::value + num_nodes<RHS>::value + num_nodes<OP>::value }; };
493 template<class LHS, class OP, class RHS> struct num_nodes< scalar_expression<LHS, RHS, OP> > { enum { value = 1 + num_nodes<LHS>::value + num_nodes<RHS>::value + num_nodes<OP>::value }; };
494 template<class LHS, class OP, class RHS> struct num_nodes< const scalar_expression<LHS, RHS, OP> > { enum { value = 1 + num_nodes<LHS>::value + num_nodes<RHS>::value + num_nodes<OP>::value }; };
495
496 }
497
502 class statement
503 {
504 public:
505 typedef statement_node value_type;
506 typedef viennacl::vcl_size_t size_type;
507 typedef std::vector<value_type> container_type;
508
509 statement(container_type const & custom_array) : array_(custom_array) {}
510
514 template<typename LHS, typename OP, typename RHS>
515 statement(LHS & lhs, OP const &, RHS const & rhs) : array_(1 + result_of::num_nodes<RHS>::value)
516 {
517 // set OP:
518 array_[0].op.type_family = operation_node_type_family(result_of::op_type_info<OP>::family);
519 array_[0].op.type = operation_node_type(result_of::op_type_info<OP>::id);
520
521 // set LHS:
522 add_lhs(0, 1, lhs);
523
524 // set RHS:
525 add_rhs(0, 1, rhs);
526 }
527
528 container_type const & array() const { return array_; }
529
530 size_type root() const { return 0; }
531
534
535 static void assign_element(lhs_rhs_element & elem, char const & t) { elem.host_char = t; }
536 static void assign_element(lhs_rhs_element & elem, unsigned char const & t) { elem.host_uchar = t; }
537 static void assign_element(lhs_rhs_element & elem, short const & t) { elem.host_short = t; }
538 static void assign_element(lhs_rhs_element & elem, unsigned short const & t) { elem.host_ushort = t; }
539 static void assign_element(lhs_rhs_element & elem, int const & t) { elem.host_int = t; }
540 static void assign_element(lhs_rhs_element & elem, unsigned int const & t) { elem.host_uint = t; }
541 static void assign_element(lhs_rhs_element & elem, long const & t) { elem.host_long = t; }
542 static void assign_element(lhs_rhs_element & elem, unsigned long const & t) { elem.host_ulong = t; }
543 static void assign_element(lhs_rhs_element & elem, float const & t) { elem.host_float = t; }
544 static void assign_element(lhs_rhs_element & elem, double const & t) { elem.host_double = t; }
545
546 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<char> const & t) { elem.scalar_char = const_cast<viennacl::scalar<char> *>(&t); }
547 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<unsigned char> const & t) { elem.scalar_uchar = const_cast<viennacl::scalar<unsigned char> *>(&t); }
548 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<short> const & t) { elem.scalar_short = const_cast<viennacl::scalar<short> *>(&t); }
549 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<unsigned short> const & t) { elem.scalar_ushort = const_cast<viennacl::scalar<unsigned short> *>(&t); }
550 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<int> const & t) { elem.scalar_int = const_cast<viennacl::scalar<int> *>(&t); }
551 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<unsigned int> const & t) { elem.scalar_uint = const_cast<viennacl::scalar<unsigned int> *>(&t); }
552 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<long> const & t) { elem.scalar_long = const_cast<viennacl::scalar<long> *>(&t); }
553 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<unsigned long> const & t) { elem.scalar_ulong = const_cast<viennacl::scalar<unsigned long> *>(&t); }
554 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<float> const & t) { elem.scalar_float = const_cast<viennacl::scalar<float> *>(&t); }
555 static void assign_element(lhs_rhs_element & elem, viennacl::scalar<double> const & t) { elem.scalar_double = const_cast<viennacl::scalar<double> *>(&t); }
556
558 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<char> const & t) { elem.vector_char = const_cast<viennacl::vector_base<char> *>(&t); }
559 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<unsigned char> const & t) { elem.vector_uchar = const_cast<viennacl::vector_base<unsigned char> *>(&t); }
560 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<short> const & t) { elem.vector_short = const_cast<viennacl::vector_base<short> *>(&t); }
561 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<unsigned short> const & t) { elem.vector_ushort = const_cast<viennacl::vector_base<unsigned short> *>(&t); }
562 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<int> const & t) { elem.vector_int = const_cast<viennacl::vector_base<int> *>(&t); }
563 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<unsigned int> const & t) { elem.vector_uint = const_cast<viennacl::vector_base<unsigned int> *>(&t); }
564 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<long> const & t) { elem.vector_long = const_cast<viennacl::vector_base<long> *>(&t); }
565 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<unsigned long> const & t) { elem.vector_ulong = const_cast<viennacl::vector_base<unsigned long> *>(&t); }
566 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<float> const & t) { elem.vector_float = const_cast<viennacl::vector_base<float> *>(&t); }
567 static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<double> const & t) { elem.vector_double = const_cast<viennacl::vector_base<double> *>(&t); }
568
569 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<char> const & t) { elem.implicit_vector_char = const_cast<viennacl::implicit_vector_base<char> *>(&t); }
570 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<unsigned char> const & t) { elem.implicit_vector_uchar = const_cast<viennacl::implicit_vector_base<unsigned char> *>(&t); }
571 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<short> const & t) { elem.implicit_vector_short = const_cast<viennacl::implicit_vector_base<short> *>(&t); }
572 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<unsigned short> const & t) { elem.implicit_vector_ushort = const_cast<viennacl::implicit_vector_base<unsigned short> *>(&t); }
573 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<int> const & t) { elem.implicit_vector_int = const_cast<viennacl::implicit_vector_base<int> *>(&t); }
574 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<unsigned int> const & t) { elem.implicit_vector_uint = const_cast<viennacl::implicit_vector_base<unsigned int> *>(&t); }
575 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<long> const & t) { elem.implicit_vector_long = const_cast<viennacl::implicit_vector_base<long> *>(&t); }
576 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<unsigned long> const & t) { elem.implicit_vector_ulong = const_cast<viennacl::implicit_vector_base<unsigned long> *>(&t); }
577 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<float> const & t) { elem.implicit_vector_float = const_cast<viennacl::implicit_vector_base<float> *>(&t); }
578 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_vector_base<double> const & t) { elem.implicit_vector_double = const_cast<viennacl::implicit_vector_base<double> *>(&t); }
579
581 // TODO: add integer matrix overloads here
582 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<char> const & t) { elem.matrix_char = const_cast<viennacl::matrix_base<char> *>(&t); }
583 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<unsigned char> const & t) { elem.matrix_uchar = const_cast<viennacl::matrix_base<unsigned char> *>(&t); }
584 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<short> const & t) { elem.matrix_short = const_cast<viennacl::matrix_base<short> *>(&t); }
585 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<unsigned short> const & t) { elem.matrix_ushort = const_cast<viennacl::matrix_base<unsigned short> *>(&t); }
586 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<int> const & t) { elem.matrix_int = const_cast<viennacl::matrix_base<int> *>(&t); }
587 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<unsigned int> const & t) { elem.matrix_uint = const_cast<viennacl::matrix_base<unsigned int> *>(&t); }
588 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<long> const & t) { elem.matrix_long = const_cast<viennacl::matrix_base<long> *>(&t); }
589 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<unsigned long> const & t) { elem.matrix_ulong = const_cast<viennacl::matrix_base<unsigned long> *>(&t); }
590 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<float> const & t) { elem.matrix_float = const_cast<viennacl::matrix_base<float> *>(&t); }
591 static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<double> const & t) { elem.matrix_double = const_cast<viennacl::matrix_base<double> *>(&t); }
592
593 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<char> const & t) { elem.implicit_matrix_char = const_cast<viennacl::implicit_matrix_base<char> *>(&t); }
594 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<unsigned char> const & t) { elem.implicit_matrix_uchar = const_cast<viennacl::implicit_matrix_base<unsigned char> *>(&t); }
595 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<short> const & t) { elem.implicit_matrix_short = const_cast<viennacl::implicit_matrix_base<short> *>(&t); }
596 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<unsigned short> const & t) { elem.implicit_matrix_ushort = const_cast<viennacl::implicit_matrix_base<unsigned short> *>(&t); }
597 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<int> const & t) { elem.implicit_matrix_int = const_cast<viennacl::implicit_matrix_base<int> *>(&t); }
598 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<unsigned int> const & t) { elem.implicit_matrix_uint = const_cast<viennacl::implicit_matrix_base<unsigned int> *>(&t); }
599 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<long> const & t) { elem.implicit_matrix_long = const_cast<viennacl::implicit_matrix_base<long> *>(&t); }
600 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<unsigned long> const & t) { elem.implicit_matrix_ulong = const_cast<viennacl::implicit_matrix_base<unsigned long> *>(&t); }
601 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<float> const & t) { elem.implicit_matrix_float = const_cast<viennacl::implicit_matrix_base<float> *>(&t); }
602 static void assign_element(lhs_rhs_element & elem, viennacl::implicit_matrix_base<double> const & t) { elem.implicit_matrix_double = const_cast<viennacl::implicit_matrix_base<double> *>(&t); }
603
604 static void assign_element(lhs_rhs_element & elem, viennacl::compressed_matrix<float> const & m) { elem.compressed_matrix_float = const_cast<viennacl::compressed_matrix<float> *>(&m); }
605 static void assign_element(lhs_rhs_element & elem, viennacl::compressed_matrix<double> const & m) { elem.compressed_matrix_double = const_cast<viennacl::compressed_matrix<double> *>(&m); }
606
607 static void assign_element(lhs_rhs_element & elem, viennacl::coordinate_matrix<float> const & m) { elem.coordinate_matrix_float = const_cast<viennacl::coordinate_matrix<float> *>(&m); }
608 static void assign_element(lhs_rhs_element & elem, viennacl::coordinate_matrix<double> const & m) { elem.coordinate_matrix_double = const_cast<viennacl::coordinate_matrix<double> *>(&m); }
609
610 static void assign_element(lhs_rhs_element & elem, viennacl::ell_matrix<float> const & m) { elem.ell_matrix_float = const_cast<viennacl::ell_matrix<float> *>(&m); }
611 static void assign_element(lhs_rhs_element & elem, viennacl::ell_matrix<double> const & m) { elem.ell_matrix_double = const_cast<viennacl::ell_matrix<double> *>(&m); }
612
613 static void assign_element(lhs_rhs_element & elem, viennacl::hyb_matrix<float> const & m) { elem.hyb_matrix_float = const_cast<viennacl::hyb_matrix<float> *>(&m); }
614 static void assign_element(lhs_rhs_element & elem, viennacl::hyb_matrix<double> const & m) { elem.hyb_matrix_double = const_cast<viennacl::hyb_matrix<double> *>(&m); }
615
617
618 template<class T>
619 static typename viennacl::enable_if<viennacl::is_primitive_type<T>::value, vcl_size_t>::type
620 add_element(vcl_size_t next_free,
621 lhs_rhs_element & elem,
622 T const & t)
623 {
624 elem.type_family = SCALAR_TYPE_FAMILY;
625 elem.subtype = HOST_SCALAR_TYPE;
626 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
627 assign_element(elem, t);
628 return next_free;
629 }
630
631 template<typename T>
632 static vcl_size_t add_element(vcl_size_t next_free,
633 lhs_rhs_element & elem,
634 viennacl::scalar<T> const & t)
635 {
636 elem.type_family = SCALAR_TYPE_FAMILY;
637 elem.subtype = DEVICE_SCALAR_TYPE;
638 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
639 assign_element(elem, t);
640 return next_free;
641 }
642
643
644 template<typename T>
645 static vcl_size_t add_element(vcl_size_t next_free,
646 lhs_rhs_element & elem,
647 viennacl::vector_base<T> const & t)
648 {
649 elem.type_family = VECTOR_TYPE_FAMILY;
650 elem.subtype = DENSE_VECTOR_TYPE;
651 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
652 assign_element(elem, t);
653 return next_free;
654 }
655
656 template<typename T>
657 static vcl_size_t add_element(vcl_size_t next_free,
658 lhs_rhs_element & elem,
659 viennacl::implicit_vector_base<T> const & t)
660 {
661 elem.type_family = VECTOR_TYPE_FAMILY;
662 elem.subtype = IMPLICIT_VECTOR_TYPE;
663 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
664 assign_element(elem, t);
665 return next_free;
666 }
667
668 template<typename T>
669 static vcl_size_t add_element(vcl_size_t next_free,
670 lhs_rhs_element & elem,
671 viennacl::matrix_base<T> const & t)
672 {
673 elem.type_family = MATRIX_TYPE_FAMILY;
674 elem.subtype = DENSE_MATRIX_TYPE;
675 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
676 assign_element(elem, t);
677 return next_free;
678 }
679
680 template<typename T>
681 static vcl_size_t add_element(vcl_size_t next_free,
682 lhs_rhs_element & elem,
683 viennacl::implicit_matrix_base<T> const & t)
684 {
685 elem.type_family = MATRIX_TYPE_FAMILY;
686 elem.subtype = IMPLICIT_MATRIX_TYPE;
687 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
688 assign_element(elem, t);
689 return next_free;
690 }
691
692 template<typename T>
693 static vcl_size_t add_element(vcl_size_t next_free,
694 lhs_rhs_element & elem,
695 viennacl::compressed_matrix<T> const & t)
696 {
697 elem.type_family = MATRIX_TYPE_FAMILY;
698 elem.subtype = COMPRESSED_MATRIX_TYPE;
699 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
700 assign_element(elem, t);
701 return next_free;
702 }
703
704 template<typename T>
705 static vcl_size_t add_element(vcl_size_t next_free,
706 lhs_rhs_element & elem,
707 viennacl::coordinate_matrix<T> const & t)
708 {
709 elem.type_family = MATRIX_TYPE_FAMILY;
710 elem.subtype = COORDINATE_MATRIX_TYPE;
711 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
712 assign_element(elem, t);
713 return next_free;
714 }
715
716 template<typename T>
717 static vcl_size_t add_element(vcl_size_t next_free,
718 lhs_rhs_element & elem,
719 viennacl::ell_matrix<T> const & t)
720 {
721 elem.type_family = MATRIX_TYPE_FAMILY;
722 elem.subtype = ELL_MATRIX_TYPE;
723 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
724 assign_element(elem, t);
725 return next_free;
726 }
727
728 template<typename T>
729 static vcl_size_t add_element(vcl_size_t next_free,
730 lhs_rhs_element & elem,
731 viennacl::hyb_matrix<T> const & t)
732 {
733 elem.type_family = MATRIX_TYPE_FAMILY;
734 elem.subtype = HYB_MATRIX_TYPE;
735 elem.numeric_type = statement_node_numeric_type(result_of::numeric_type_id<T>::value);
736 assign_element(elem, t);
737 return next_free;
738 }
739
740 private:
741
743
744 template<typename LHS, typename RHS, typename OP>
745 vcl_size_t add_element(vcl_size_t next_free,
746 lhs_rhs_element & elem,
747 viennacl::scalar_expression<LHS, RHS, OP> const & t)
748 {
749 elem.type_family = COMPOSITE_OPERATION_FAMILY;
750 elem.subtype = INVALID_SUBTYPE;
751 elem.numeric_type = INVALID_NUMERIC_TYPE;
752 elem.node_index = next_free;
753 return add_node(next_free, next_free + 1, t);
754 }
755
756 template<typename LHS, typename RHS, typename OP>
757 vcl_size_t add_element(vcl_size_t next_free,
758 lhs_rhs_element & elem,
759 viennacl::vector_expression<LHS, RHS, OP> const & t)
760 {
761 elem.type_family = COMPOSITE_OPERATION_FAMILY;
762 elem.subtype = INVALID_SUBTYPE;
763 elem.numeric_type = INVALID_NUMERIC_TYPE;
764 elem.node_index = next_free;
765 return add_node(next_free, next_free + 1, t);
766 }
767
768 template<typename LHS, typename RHS, typename OP>
769 vcl_size_t add_element(vcl_size_t next_free,
770 lhs_rhs_element & elem,
771 viennacl::matrix_expression<LHS, RHS, OP> const & t)
772 {
773 elem.type_family = COMPOSITE_OPERATION_FAMILY;
774 elem.subtype = INVALID_SUBTYPE;
775 elem.numeric_type = INVALID_NUMERIC_TYPE;
776 elem.node_index = next_free;
777 return add_node(next_free, next_free + 1, t);
778 }
779
781
782
783 template<typename T>
784 vcl_size_t add_lhs(vcl_size_t current_index, vcl_size_t next_free, T const & t)
785 {
786 return add_element(next_free, array_[current_index].lhs, t);
787 }
788
789 template<typename T>
790 vcl_size_t add_rhs(vcl_size_t current_index, vcl_size_t next_free, T const & t)
791 {
792 return add_element(next_free, array_[current_index].rhs, t);
793 }
794
796
797 template<template<typename, typename, typename> class ExpressionT, typename LHS, typename RHS, typename OP>
798 vcl_size_t add_node(vcl_size_t current_index, vcl_size_t next_free, ExpressionT<LHS, RHS, OP> const & proxy)
799 {
800 // set OP:
801 array_[current_index].op.type_family = operation_node_type_family(result_of::op_type_info<OP>::family);
802 array_[current_index].op.type = operation_node_type(result_of::op_type_info<OP>::id);
803
804 // set LHS and RHS:
805 if (array_[current_index].op.type_family == OPERATION_UNARY_TYPE_FAMILY)
806 {
807 // unary expression: set rhs to invalid:
808 array_[current_index].rhs.type_family = INVALID_TYPE_FAMILY;
809 array_[current_index].rhs.subtype = INVALID_SUBTYPE;
810 array_[current_index].rhs.numeric_type = INVALID_NUMERIC_TYPE;
811 return add_lhs(current_index, next_free, proxy.lhs());
812 }
813
814 return add_rhs(current_index, add_lhs(current_index, next_free, proxy.lhs()), proxy.rhs());
815 }
816
817 container_type array_;
818 };
819
820 namespace detail
821 {
823 inline void execute_composite(statement const & /* s */, statement_node const & /* root_node */);
824 }
825
826 } // namespace scheduler
827 } // namespace viennacl
828
829 #endif
830
viennacl::scheduler::OPERATION_UNARY_NORM_INF_TYPE
Definition: forwards.h:109
viennacl::hyb_matrix< float >
viennacl::enable_if
Simple enable-if variant that uses the SFINAE pattern.
Definition: enable_if.hpp:30
viennacl::scheduler::OPERATION_UNARY_ATAN_TYPE
Definition: forwards.h:91
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, unsigned short const &t)
Definition: forwards.h:538
viennacl::scheduler::HYB_MATRIX_TYPE
Definition: forwards.h:280
viennacl::scheduler::lhs_rhs_element::implicit_vector_float
viennacl::implicit_vector_base< float > * implicit_vector_float
Definition: forwards.h:397
viennacl::scheduler::INT_TYPE
Definition: forwards.h:294
viennacl::scheduler::OPERATION_BINARY_VECTOR_DIAG_TYPE
Definition: forwards.h:141
viennacl::scheduler::HALF_TYPE
Definition: forwards.h:298
viennacl::scheduler::lhs_rhs_element::host_ulong
unsigned long host_ulong
Definition: forwards.h:358
viennacl::scheduler::OPERATION_BINARY_MAT_VEC_PROD_TYPE
Definition: forwards.h:144
viennacl::scalar< char >
viennacl::scheduler::lhs_rhs_element::scalar_float
viennacl::scalar< float > * scalar_float
Definition: forwards.h:373
viennacl::scheduler::OPERATION_BINARY_ELEMENT_POW_TYPE
Definition: forwards.h:134
viennacl::scheduler::lhs_rhs_element::vector_ushort
viennacl::vector_base< unsigned short > * vector_ushort
Definition: forwards.h:380
viennacl::scheduler::lhs_rhs_element::implicit_vector_int
viennacl::implicit_vector_base< int > * implicit_vector_int
Definition: forwards.h:393
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< char > const &t)
Definition: forwards.h:569
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< float > const &t)
Definition: forwards.h:554
viennacl::scheduler::OPERATION_VECTOR_REDUCTION_TYPE_FAMILY
Definition: forwards.h:62
viennacl::scheduler::lhs_rhs_element::vector_uint
viennacl::vector_base< unsigned int > * vector_uint
Definition: forwards.h:382
viennacl::scheduler::lhs_rhs_element::implicit_vector_uchar
viennacl::implicit_vector_base< unsigned char > * implicit_vector_uchar
Definition: forwards.h:390
viennacl::scheduler::OPERATION_BINARY_ELEMENT_MAX_TYPE
Definition: forwards.h:137
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned char > const &t)
Definition: forwards.h:570
viennacl::scheduler::lhs_rhs_element::matrix_short
viennacl::matrix_base< short > * matrix_short
Definition: forwards.h:403
viennacl::scheduler::OPERATION_UNARY_TRANS_TYPE
Definition: forwards.h:106
viennacl::scheduler::UCHAR_TYPE
Definition: forwards.h:291
viennacl::scheduler::lhs_rhs_element::vector_short
viennacl::vector_base< short > * vector_short
Definition: forwards.h:379
viennacl::scheduler::OPERATION_UNARY_COS_TYPE
Definition: forwards.h:93
viennacl::scheduler::OPERATION_UNARY_FABS_TYPE
Definition: forwards.h:96
viennacl::scheduler::lhs_rhs_element::scalar_short
viennacl::scalar< short > * scalar_short
Definition: forwards.h:367
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< short > const &t)
Definition: forwards.h:584
viennacl::scheduler::OPERATION_BINARY_ELEMENT_GEQ_TYPE
Definition: forwards.h:131
viennacl::scheduler::statement::value_type
statement_node value_type
Definition: forwards.h:505
viennacl::scheduler::statement::statement
statement(LHS &lhs, OP const &, RHS const &rhs)
Generate the runtime statement from an expression template.
Definition: forwards.h:515
viennacl::scheduler::lhs_rhs_element::matrix_char
viennacl::matrix_base< char > * matrix_char
Definition: forwards.h:401
viennacl::scheduler::DEVICE_SCALAR_TYPE
Definition: forwards.h:269
viennacl::scheduler::DENSE_VECTOR_TYPE
Definition: forwards.h:271
viennacl::scheduler::INVALID_TYPE_FAMILY
Definition: forwards.h:248
viennacl::scheduler::lhs_rhs_element::implicit_matrix_ulong
viennacl::implicit_matrix_base< unsigned long > * implicit_matrix_ulong
Definition: forwards.h:419
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, char const &t)
Definition: forwards.h:535
viennacl::scheduler::OPERATION_BINARY_ELEMENT_DIV_TYPE
Definition: forwards.h:127
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, double const &t)
Definition: forwards.h:544
viennacl::scheduler::DOUBLE_TYPE
Definition: forwards.h:300
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::hyb_matrix< float > const &m)
Definition: forwards.h:613
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned char > const &t)
Definition: forwards.h:583
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned long > const &t)
Definition: forwards.h:600
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< short > const &t)
Definition: forwards.h:595
viennacl::scheduler::COORDINATE_MATRIX_TYPE
Definition: forwards.h:278
viennacl::scheduler::INVALID_SUBTYPE
Definition: forwards.h:266
viennacl::scheduler::OPERATION_UNARY_ACOS_TYPE
Definition: forwards.h:89
viennacl::scheduler::OPERATION_INVALID_TYPE
Definition: forwards.h:70
viennacl::scheduler::OPERATION_UNARY_EXP_TYPE
Definition: forwards.h:95
viennacl::matrix_base< char >
viennacl::scheduler::lhs_rhs_element::vector_int
viennacl::vector_base< int > * vector_int
Definition: forwards.h:381
viennacl::scheduler::lhs_rhs_element::subtype
statement_node_subtype subtype
Definition: forwards.h:340
viennacl::matrix_expression
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:341
viennacl::scheduler::OPERATION_UNARY_CAST_FLOAT_TYPE
Definition: forwards.h:85
viennacl::scheduler::MATRIX_TYPE_FAMILY
Definition: forwards.h:260
viennacl::scheduler::OPERATION_UNARY_ASIN_TYPE
Definition: forwards.h:90
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, unsigned char const &t)
Definition: forwards.h:536
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< short > const &t)
Definition: forwards.h:560
viennacl::scheduler::statement::size_type
viennacl::vcl_size_t size_type
Definition: forwards.h:506
viennacl::scheduler::result_of::op_type_info::error_type
T::ERROR_UNKNOWN_OP_TYPE error_type
Definition: forwards.h:158
viennacl::scheduler::lhs_rhs_element::coordinate_matrix_double
viennacl::coordinate_matrix< double > * coordinate_matrix_double
Definition: forwards.h:443
viennacl::scheduler::statement_node::op
op_element op
Definition: forwards.h:481
viennacl::scheduler::SCALAR_TYPE_FAMILY
Definition: forwards.h:254
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< long > const &t)
Definition: forwards.h:588
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::scheduler::lhs_rhs_element::implicit_vector_long
viennacl::implicit_vector_base< long > * implicit_vector_long
Definition: forwards.h:395
viennacl::scheduler::lhs_rhs_element::type_family
statement_node_type_family type_family
Definition: forwards.h:339
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned int > const &t)
Definition: forwards.h:551
viennacl::scheduler::lhs_rhs_element::implicit_matrix_double
viennacl::implicit_matrix_base< double > * implicit_matrix_double
Definition: forwards.h:421
viennacl::scheduler::OPERATION_BINARY_MATRIX_ROW_TYPE
Definition: forwards.h:142
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned short > const &t)
Definition: forwards.h:585
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned short > const &t)
Definition: forwards.h:561
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< double > const &t)
Definition: forwards.h:567
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< long > const &t)
Definition: forwards.h:599
viennacl::scheduler::OPERATION_BINARY_ASSIGN_TYPE
Definition: forwards.h:115
viennacl::scheduler::OPERATION_UNARY_CAST_HALF_TYPE
Definition: forwards.h:84
viennacl::scheduler::lhs_rhs_element
A class representing the 'data' for the LHS or RHS operand of the respective node.
Definition: forwards.h:337
viennacl::scheduler::lhs_rhs_element::matrix_uchar
viennacl::matrix_base< unsigned char > * matrix_uchar
Definition: forwards.h:402
viennacl::scheduler::statement::array
container_type const & array() const
Definition: forwards.h:528
viennacl::scheduler::lhs_rhs_element::scalar_uint
viennacl::scalar< unsigned int > * scalar_uint
Definition: forwards.h:370
viennacl::scheduler::result_of::num_nodes
Definition: forwards.h:488
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< char > const &t)
Definition: forwards.h:593
viennacl::scheduler::lhs_rhs_element::scalar_long
viennacl::scalar< long > * scalar_long
Definition: forwards.h:371
viennacl::scheduler::OPERATION_INVALID_TYPE_FAMILY
Definition: forwards.h:55
viennacl::scheduler::lhs_rhs_element::host_long
long host_long
Definition: forwards.h:357
viennacl::scheduler::HOST_SCALAR_TYPE
Definition: forwards.h:268
viennacl::scheduler::statement_node_numeric_type
statement_node_numeric_type
Encodes the type of a node in the statement tree.
Definition: forwards.h:286
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, float const &t)
Definition: forwards.h:543
viennacl::scalar_expression
A proxy for scalar expressions (e.g. from inner vector products)
Definition: forwards.h:230
viennacl::vector_expression
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:239
viennacl::scheduler::statement::add_element
static viennacl::enable_if< viennacl::is_primitive_type< T >::value, vcl_size_t >::type add_element(vcl_size_t next_free, lhs_rhs_element &elem, T const &t)
Definition: forwards.h:620
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::ell_matrix< float > const &m)
Definition: forwards.h:610
viennacl::scheduler::op_element::type_family
operation_node_type_family type_family
Definition: forwards.h:473
viennacl::scheduler::op_element
Struct for holding the type family as well as the type of an operation (could be addition, subtraction, norm, etc.)
Definition: forwards.h:471
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< char > const &t)
Definition: forwards.h:558
viennacl::scheduler::OPERATION_UNARY_CAST_UCHAR_TYPE
Definition: forwards.h:77
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned int > const &t)
Definition: forwards.h:574
viennacl::scheduler::OPERATION_COLUMNS_REDUCTION_TYPE_FAMILY
Definition: forwards.h:64
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::matrix_base< T > const &t)
Definition: forwards.h:669
viennacl::scheduler::OPERATION_BINARY_ELEMENT_PROD_TYPE
Definition: forwards.h:126
viennacl::scheduler::lhs_rhs_element::host_short
short host_short
Definition: forwards.h:353
viennacl::scheduler::lhs_rhs_element::matrix_double
viennacl::matrix_base< double > * matrix_double
Definition: forwards.h:410
viennacl::scheduler::lhs_rhs_element::hyb_matrix_double
viennacl::hyb_matrix< double > * hyb_matrix_double
Definition: forwards.h:465
viennacl::scheduler::lhs_rhs_element::implicit_matrix_uint
viennacl::implicit_matrix_base< unsigned int > * implicit_matrix_uint
Definition: forwards.h:417
viennacl::scheduler::COMPOSITE_OPERATION_FAMILY
Definition: forwards.h:251
viennacl::scheduler::lhs_rhs_element::scalar_ulong
viennacl::scalar< unsigned long > * scalar_ulong
Definition: forwards.h:372
viennacl::scheduler::OPERATION_UNARY_NORM_2_TYPE
Definition: forwards.h:108
viennacl::scheduler::lhs_rhs_element::implicit_vector_uint
viennacl::implicit_vector_base< unsigned int > * implicit_vector_uint
Definition: forwards.h:394
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< int > const &t)
Definition: forwards.h:597
viennacl::scheduler::SHORT_TYPE
Definition: forwards.h:292
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::compressed_matrix< float > const &m)
Definition: forwards.h:604
viennacl::scheduler::statement_node_subtype
statement_node_subtype
Encodes the type of a node in the statement tree.
Definition: forwards.h:264
viennacl::scheduler::statement::container_type
std::vector< value_type > container_type
Definition: forwards.h:507
viennacl::scheduler::lhs_rhs_element::matrix_long
viennacl::matrix_base< long > * matrix_long
Definition: forwards.h:407
viennacl::scheduler::LONG_TYPE
Definition: forwards.h:296
viennacl::scheduler::DENSE_MATRIX_TYPE
Definition: forwards.h:274
viennacl::scheduler::OPERATION_BINARY_ELEMENT_FMIN_TYPE
Definition: forwards.h:136
viennacl::scheduler::lhs_rhs_element::host_double
double host_double
Definition: forwards.h:360
viennacl::implicit_matrix_base< char >
viennacl::scheduler::lhs_rhs_element::matrix_ushort
viennacl::matrix_base< unsigned short > * matrix_ushort
Definition: forwards.h:404
viennacl::scheduler::lhs_rhs_element::host_char
char host_char
Definition: forwards.h:351
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::ell_matrix< T > const &t)
Definition: forwards.h:717
viennacl::scheduler::lhs_rhs_element::implicit_matrix_ushort
viennacl::implicit_matrix_base< unsigned short > * implicit_matrix_ushort
Definition: forwards.h:415
viennacl::scheduler::OPERATION_UNARY_LOG_TYPE
Definition: forwards.h:98
viennacl::scheduler::lhs_rhs_element::compressed_matrix_float
viennacl::compressed_matrix< float > * compressed_matrix_float
Definition: forwards.h:431
viennacl::scheduler::OPERATION_BINARY_ELEMENT_GREATER_TYPE
Definition: forwards.h:130
viennacl::scheduler::OPERATION_UNARY_CAST_LONG_TYPE
Definition: forwards.h:82
viennacl::scheduler::OPERATION_BINARY_INNER_PROD_TYPE
Definition: forwards.h:146
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< int > const &t)
Definition: forwards.h:550
viennacl::scheduler::OPERATION_UNARY_MAX_TYPE
Definition: forwards.h:110
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< float > const &t)
Definition: forwards.h:601
viennacl::ell_matrix< float >
viennacl::scheduler::OPERATION_UNARY_SQRT_TYPE
Definition: forwards.h:102
viennacl::scheduler::CHAR_TYPE
Definition: forwards.h:290
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< double > const &t)
Definition: forwards.h:555
viennacl::scheduler::statement_not_supported_exception::~statement_not_supported_exception
virtual ~statement_not_supported_exception()
Definition: forwards.h:46
viennacl::scheduler::INVALID_NUMERIC_TYPE
Definition: forwards.h:288
viennacl::scheduler::OPERATION_BINARY_INPLACE_ADD_TYPE
Definition: forwards.h:116
viennacl::scheduler::OPERATION_UNARY_SINH_TYPE
Definition: forwards.h:101
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned long > const &t)
Definition: forwards.h:576
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned short > const &t)
Definition: forwards.h:596
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::coordinate_matrix< float > const &m)
Definition: forwards.h:607
viennacl::scheduler::lhs_rhs_element::implicit_matrix_uchar
viennacl::implicit_matrix_base< unsigned char > * implicit_matrix_uchar
Definition: forwards.h:413
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::implicit_vector_base< T > const &t)
Definition: forwards.h:657
viennacl::scheduler::lhs_rhs_element::numeric_type
statement_node_numeric_type numeric_type
Definition: forwards.h:341
viennacl::scheduler::OPERATION_BINARY_ELEMENT_NEQ_TYPE
Definition: forwards.h:129
viennacl::scheduler::lhs_rhs_element::vector_ulong
viennacl::vector_base< unsigned long > * vector_ulong
Definition: forwards.h:384
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< float > const &t)
Definition: forwards.h:590
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< double > const &t)
Definition: forwards.h:578
viennacl::scheduler::result_of::num_nodes::value
Definition: forwards.h:488
viennacl::scheduler::lhs_rhs_element::vector_float
viennacl::vector_base< float > * vector_float
Definition: forwards.h:385
viennacl::scheduler::OPERATION_UNARY_SIN_TYPE
Definition: forwards.h:100
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::hyb_matrix< T > const &t)
Definition: forwards.h:729
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned int > const &t)
Definition: forwards.h:563
viennacl::scheduler::result_of::op_type_info
Metafunction for querying type informations.
Definition: forwards.h:156
viennacl::scheduler::statement_node::rhs
lhs_rhs_element rhs
Definition: forwards.h:482
viennacl::scheduler::lhs_rhs_element::matrix_float
viennacl::matrix_base< float > * matrix_float
Definition: forwards.h:409
viennacl::scheduler::OPERATION_UNARY_CAST_USHORT_TYPE
Definition: forwards.h:79
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< float > const &t)
Definition: forwards.h:577
viennacl::scheduler::lhs_rhs_element::implicit_vector_char
viennacl::implicit_vector_base< char > * implicit_vector_char
Definition: forwards.h:389
viennacl::vector_base< char >
viennacl::scheduler::OPERATION_UNARY_CAST_DOUBLE_TYPE
Definition: forwards.h:86
viennacl::scheduler::OPERATION_UNARY_ABS_TYPE
Definition: forwards.h:88
viennacl::scheduler::lhs_rhs_element::implicit_vector_ulong
viennacl::implicit_vector_base< unsigned long > * implicit_vector_ulong
Definition: forwards.h:396
viennacl::scheduler::statement_node::lhs
lhs_rhs_element lhs
Definition: forwards.h:480
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::ell_matrix< double > const &m)
Definition: forwards.h:611
viennacl::scheduler::OPERATION_UNARY_CAST_UINT_TYPE
Definition: forwards.h:81
viennacl::vcl_size_t
std::size_t vcl_size_t
Definition: forwards.h:75
viennacl::scheduler::lhs_rhs_element::vector_double
viennacl::vector_base< double > * vector_double
Definition: forwards.h:386
viennacl::scheduler::OPERATION_BINARY_TYPE_FAMILY
Definition: forwards.h:59
viennacl::scheduler::lhs_rhs_element::compressed_matrix_double
viennacl::compressed_matrix< double > * compressed_matrix_double
Definition: forwards.h:432
viennacl::scheduler::lhs_rhs_element::ell_matrix_double
viennacl::ell_matrix< double > * ell_matrix_double
Definition: forwards.h:454
viennacl::scheduler::OPERATION_BINARY_MATRIX_DIAG_TYPE
Definition: forwards.h:140
viennacl::scheduler::lhs_rhs_element::matrix_ulong
viennacl::matrix_base< unsigned long > * matrix_ulong
Definition: forwards.h:408
viennacl::scheduler::lhs_rhs_element::hyb_matrix_float
viennacl::hyb_matrix< float > * hyb_matrix_float
Definition: forwards.h:464
viennacl::scheduler::lhs_rhs_element::scalar_double
viennacl::scalar< double > * scalar_double
Definition: forwards.h:374
viennacl::scheduler::OPERATION_UNARY_LOG10_TYPE
Definition: forwards.h:99
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned int > const &t)
Definition: forwards.h:598
viennacl::scheduler::lhs_rhs_element::scalar_ushort
viennacl::scalar< unsigned short > * scalar_ushort
Definition: forwards.h:368
viennacl::scheduler::detail::execute_composite
void execute_composite(statement const &s, statement_node const &root_node)
Deals with x = RHS where RHS is an expression and x is either a scalar, a vector, or a matrix...
Definition: execute.hpp:42
viennacl::scheduler::OPERATION_UNARY_FLOOR_TYPE
Definition: forwards.h:97
viennacl::scheduler::OPERATION_BINARY_SUB_TYPE
Definition: forwards.h:119
viennacl::scheduler::USHORT_TYPE
Definition: forwards.h:293
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned char > const &t)
Definition: forwards.h:547
viennacl::scheduler::operation_node_type
operation_node_type
Enumeration for identifying the possible operations.
Definition: forwards.h:68
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< double > const &t)
Definition: forwards.h:591
viennacl::scheduler::lhs_rhs_element::vector_char
viennacl::vector_base< char > * vector_char
Definition: forwards.h:377
viennacl::scheduler::IMPLICIT_VECTOR_TYPE
Definition: forwards.h:272
viennacl::scheduler::lhs_rhs_element::implicit_vector_short
viennacl::implicit_vector_base< short > * implicit_vector_short
Definition: forwards.h:391
viennacl::scheduler::statement::statement
statement(container_type const &custom_array)
Definition: forwards.h:509
predicate.hpp
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned long > const &t)
Definition: forwards.h:553
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< long > const &t)
Definition: forwards.h:552
viennacl::scheduler::OPERATION_UNARY_CAST_INT_TYPE
Definition: forwards.h:80
viennacl::scheduler::result_of::numeric_type_id
Helper metafunction for obtaining the runtime type ID for a numerical type.
Definition: forwards.h:310
viennacl::scheduler::lhs_rhs_element::scalar_uchar
viennacl::scalar< unsigned char > * scalar_uchar
Definition: forwards.h:366
viennacl::scheduler::OPERATION_UNARY_MIN_TYPE
Definition: forwards.h:111
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< short > const &t)
Definition: forwards.h:571
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, int const &t)
Definition: forwards.h:539
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::vector_base< T > const &t)
Definition: forwards.h:645
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::coordinate_matrix< double > const &m)
Definition: forwards.h:608
viennacl::scheduler::OPERATION_BINARY_INPLACE_SUB_TYPE
Definition: forwards.h:117
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, long const &t)
Definition: forwards.h:541
viennacl::scheduler::lhs_rhs_element::host_float
float host_float
Definition: forwards.h:359
viennacl::scheduler::OPERATION_BINARY_MATRIX_COLUMN_TYPE
Definition: forwards.h:143
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< int > const &t)
Definition: forwards.h:562
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned short > const &t)
Definition: forwards.h:572
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned short > const &t)
Definition: forwards.h:549
viennacl::scheduler::lhs_rhs_element::vector_uchar
viennacl::vector_base< unsigned char > * vector_uchar
Definition: forwards.h:378
viennacl::scheduler::OPERATION_BINARY_ACCESS_TYPE
Definition: forwards.h:114
viennacl::scheduler::OPERATION_BINARY_ELEMENT_ARGMAX_TYPE
Definition: forwards.h:124
viennacl::device_specific::utils::lhs_rhs_element
scheduler::lhs_rhs_element & lhs_rhs_element(scheduler::statement const &st, vcl_size_t idx, leaf_t leaf)
Definition: utils.hpp:525
viennacl::scheduler::IMPLICIT_MATRIX_TYPE
Definition: forwards.h:275
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned long > const &t)
Definition: forwards.h:589
viennacl::scheduler::OPERATION_UNARY_TAN_TYPE
Definition: forwards.h:103
viennacl::scheduler::lhs_rhs_element::implicit_matrix_float
viennacl::implicit_matrix_base< float > * implicit_matrix_float
Definition: forwards.h:420
viennacl::scheduler::lhs_rhs_element::ell_matrix_float
viennacl::ell_matrix< float > * ell_matrix_float
Definition: forwards.h:453
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::compressed_matrix< T > const &t)
Definition: forwards.h:693
viennacl::scheduler::ELL_MATRIX_TYPE
Definition: forwards.h:279
viennacl::scheduler::OPERATION_UNARY_MINUS_TYPE
Definition: forwards.h:73
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, unsigned long const &t)
Definition: forwards.h:542
viennacl::scheduler::lhs_rhs_element::scalar_int
viennacl::scalar< int > * scalar_int
Definition: forwards.h:369
viennacl::scheduler::lhs_rhs_element::host_ushort
unsigned short host_ushort
Definition: forwards.h:354
viennacl::scheduler::lhs_rhs_element::implicit_vector_double
viennacl::implicit_vector_base< double > * implicit_vector_double
Definition: forwards.h:398
viennacl::scheduler::OPERATION_UNARY_CEIL_TYPE
Definition: forwards.h:92
viennacl::scheduler::op_element::type
operation_node_type type
Definition: forwards.h:474
viennacl::scheduler::OPERATION_BINARY_DIV_TYPE
Definition: forwards.h:121
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned long > const &t)
Definition: forwards.h:565
viennacl::scheduler::OPERATION_BINARY_ELEMENT_FMAX_TYPE
Definition: forwards.h:135
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::compressed_matrix< double > const &m)
Definition: forwards.h:605
viennacl::scheduler::statement_not_supported_exception::statement_not_supported_exception
statement_not_supported_exception(std::string message)
Definition: forwards.h:42
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, unsigned int const &t)
Definition: forwards.h:540
viennacl::scheduler::UINT_TYPE
Definition: forwards.h:295
viennacl::scheduler::OPERATION_BINARY_ELEMENT_ARGFMAX_TYPE
Definition: forwards.h:122
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned char > const &t)
Definition: forwards.h:594
viennacl::scheduler::OPERATION_UNARY_TANH_TYPE
Definition: forwards.h:104
viennacl::scheduler::FLOAT_TYPE
Definition: forwards.h:299
viennacl::scheduler::OPERATION_UNARY_CAST_SHORT_TYPE
Definition: forwards.h:78
viennacl::scheduler::lhs_rhs_element::host_uint
unsigned int host_uint
Definition: forwards.h:356
viennacl::compressed_matrix< float >
viennacl::scheduler::lhs_rhs_element::implicit_vector_ushort
viennacl::implicit_vector_base< unsigned short > * implicit_vector_ushort
Definition: forwards.h:392
viennacl::scheduler::statement::root
size_type root() const
Definition: forwards.h:530
viennacl::scheduler::statement
The main class for representing a statement such as x = inner_prod(y,z); at runtime.
Definition: forwards.h:502
viennacl::scheduler::lhs_rhs_element::scalar_char
viennacl::scalar< char > * scalar_char
Definition: forwards.h:365
viennacl::scheduler::OPERATION_BINARY_ADD_TYPE
Definition: forwards.h:118
viennacl::scheduler::lhs_rhs_element::implicit_matrix_short
viennacl::implicit_matrix_base< short > * implicit_matrix_short
Definition: forwards.h:414
viennacl::scheduler::lhs_rhs_element::node_index
vcl_size_t node_index
Definition: forwards.h:346
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::implicit_matrix_base< T > const &t)
Definition: forwards.h:681
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned int > const &t)
Definition: forwards.h:587
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< int > const &t)
Definition: forwards.h:586
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::scalar< T > const &t)
Definition: forwards.h:632
viennacl::implicit_vector_base< char >
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< long > const &t)
Definition: forwards.h:575
viennacl::scheduler::OPERATION_BINARY_ELEMENT_ARGMIN_TYPE
Definition: forwards.h:125
viennacl::scheduler::OPERATION_BINARY_ELEMENT_ARGFMIN_TYPE
Definition: forwards.h:123
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< float > const &t)
Definition: forwards.h:566
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< char > const &t)
Definition: forwards.h:582
viennacl::scheduler::OPERATION_BINARY_ELEMENT_MIN_TYPE
Definition: forwards.h:138
viennacl::scheduler::ULONG_TYPE
Definition: forwards.h:297
viennacl::scheduler::OPERATION_ROWS_REDUCTION_TYPE_FAMILY
Definition: forwards.h:63
viennacl::scheduler::OPERATION_UNARY_CAST_ULONG_TYPE
Definition: forwards.h:83
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< double > const &t)
Definition: forwards.h:602
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< int > const &t)
Definition: forwards.h:573
viennacl::scheduler::lhs_rhs_element::matrix_int
viennacl::matrix_base< int > * matrix_int
Definition: forwards.h:405
viennacl::scheduler::lhs_rhs_element::implicit_matrix_long
viennacl::implicit_matrix_base< long > * implicit_matrix_long
Definition: forwards.h:418
viennacl::scheduler::statement::add_element
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::coordinate_matrix< T > const &t)
Definition: forwards.h:705
viennacl::scheduler::OPERATION_UNARY_COSH_TYPE
Definition: forwards.h:94
viennacl::scheduler::lhs_rhs_element::host_int
int host_int
Definition: forwards.h:355
viennacl::scheduler::lhs_rhs_element::vector_long
viennacl::vector_base< long > * vector_long
Definition: forwards.h:383
op_assign
Definition: self_assign.cpp:132
viennacl::scheduler::lhs_rhs_element::coordinate_matrix_float
viennacl::coordinate_matrix< float > * coordinate_matrix_float
Definition: forwards.h:442
viennacl::scheduler::VECTOR_TYPE_FAMILY
Definition: forwards.h:257
viennacl::scheduler::statement_not_supported_exception::what
virtual const char * what() const
Definition: forwards.h:44
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::hyb_matrix< double > const &m)
Definition: forwards.h:614
viennacl::scheduler::statement_not_supported_exception::statement_not_supported_exception
statement_not_supported_exception()
Definition: forwards.h:41
viennacl::scheduler::OPERATION_BINARY_ELEMENT_EQ_TYPE
Definition: forwards.h:128
viennacl::scheduler::lhs_rhs_element::implicit_matrix_char
viennacl::implicit_matrix_base< char > * implicit_matrix_char
Definition: forwards.h:412
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< char > const &t)
Definition: forwards.h:546
viennacl::scheduler::OPERATION_UNARY_CAST_CHAR_TYPE
Definition: forwards.h:76
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< short > const &t)
Definition: forwards.h:548
viennacl::scheduler::statement_node
Main datastructure for an node in the statement tree.
Definition: forwards.h:478
viennacl::scheduler::OPERATION_BINARY_MAT_MAT_PROD_TYPE
Definition: forwards.h:145
viennacl::scheduler::statement_not_supported_exception
Exception for the case the scheduler is unable to deal with the operation.
Definition: forwards.h:38
enable_if.hpp
Simple enable-if variant that uses the SFINAE pattern.
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, short const &t)
Definition: forwards.h:537
viennacl::scheduler::statement_node_type_family
statement_node_type_family
Groups the type of a node in the statement tree. Used for faster dispatching.
Definition: forwards.h:246
viennacl::scheduler::COMPRESSED_MATRIX_TYPE
Definition: forwards.h:277
viennacl::scheduler::lhs_rhs_element::matrix_uint
viennacl::matrix_base< unsigned int > * matrix_uint
Definition: forwards.h:406
viennacl::coordinate_matrix< float >
viennacl::scheduler::operation_node_type_family
operation_node_type_family
Optimization enum for grouping operations into unary or binary operations. Just for optimization of l...
Definition: forwards.h:53
viennacl::scheduler::lhs_rhs_element::host_uchar
unsigned char host_uchar
Definition: forwards.h:352
viennacl::scheduler::lhs_rhs_element::implicit_matrix_int
viennacl::implicit_matrix_base< int > * implicit_matrix_int
Definition: forwards.h:416
viennacl::scheduler::OPERATION_BINARY_ELEMENT_LEQ_TYPE
Definition: forwards.h:133
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< long > const &t)
Definition: forwards.h:564
viennacl::scheduler::statement::assign_element
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned char > const &t)
Definition: forwards.h:559
viennacl::scheduler::OPERATION_UNARY_TYPE_FAMILY
Definition: forwards.h:58
viennacl::scheduler::OPERATION_UNARY_NORM_1_TYPE
Definition: forwards.h:107
viennacl::op_element_cast
A tag class representing element-wise casting operations on vectors and matrices. ...
Definition: forwards.h:126
viennacl::scheduler::OPERATION_BINARY_ELEMENT_LESS_TYPE
Definition: forwards.h:132
viennacl::scheduler::OPERATION_BINARY_MULT_TYPE
Definition: forwards.h:120