ViennaCL - The Vienna Computing Library: viennacl/scheduler/execute_elementwise.hpp 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
execute_elementwise.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_SCHEDULER_EXECUTE_ELEMENTWISE_HPP
2 #define VIENNACL_SCHEDULER_EXECUTE_ELEMENTWISE_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/forwards.h"
27 #include "viennacl/scheduler/forwards.h"
28 #include "viennacl/scheduler/execute_util.hpp"
29 #include "viennacl/linalg/vector_operations.hpp"
30 #include "viennacl/linalg/matrix_operations.hpp"
31
32 namespace viennacl
33 {
34 namespace scheduler
35 {
36 namespace detail
37 {
38 // result = element_op(x,y) for vectors or matrices x, y
39 inline void element_op(lhs_rhs_element result,
40 lhs_rhs_element const & x,
41 operation_node_type op_type)
42 {
43 assert( result.numeric_type == x.numeric_type && bool("Numeric type not the same!"));
44 assert( result.type_family == x.type_family && bool("Subtype not the same!"));
45
46 if (x.subtype == DENSE_VECTOR_TYPE)
47 {
48 assert( result.subtype == x.subtype && bool("result not of vector type for unary elementwise operation"));
49 if (x.numeric_type == FLOAT_TYPE)
50 {
51 switch (op_type)
52 {
53 #define VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPNAME, NumericT, OPTAG) \
54 case OPNAME: viennacl::linalg::element_op(*result.vector_##NumericT, \
55 viennacl::vector_expression<const vector_base<NumericT>, const vector_base<NumericT>, \
56 op_element_unary<OPTAG> >(*x.vector_##NumericT, *x.vector_##NumericT)); break;
57
58 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, float, op_abs)
59 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, float, op_acos)
60 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, float, op_asin)
61 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, float, op_atan)
62 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, float, op_ceil)
63 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, float, op_cos)
64 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, float, op_cosh)
65 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, float, op_exp)
66 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, float, op_fabs)
67 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, float, op_floor)
68 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, float, op_log)
69 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, float, op_log10)
70 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, float, op_sin)
71 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, float, op_sinh)
72 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, float, op_sqrt)
73 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, float, op_tan)
74 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, float, op_tanh)
75 default:
76 throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
77 }
78 }
79 else if (x.numeric_type == DOUBLE_TYPE)
80 {
81 switch (op_type)
82 {
83 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, double, op_abs)
84 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, double, op_acos)
85 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, double, op_asin)
86 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, double, op_atan)
87 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, double, op_ceil)
88 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, double, op_cos)
89 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, double, op_cosh)
90 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, double, op_exp)
91 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, double, op_fabs)
92 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, double, op_floor)
93 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, double, op_log)
94 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, double, op_log10)
95 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, double, op_sin)
96 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, double, op_sinh)
97 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, double, op_sqrt)
98 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, double, op_tan)
99 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, double, op_tanh)
100
101 #undef VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP
102 default:
103 throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
104 }
105 }
106 else
107 throw statement_not_supported_exception("Invalid numeric type in unary elementwise operator");
108 }
109 else if (x.subtype == DENSE_MATRIX_TYPE)
110 {
111 if (x.numeric_type == FLOAT_TYPE)
112 {
113 switch (op_type)
114 {
115 #define VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPNAME, NumericT, OPTAG) \
116 case OPNAME: viennacl::linalg::element_op(*result.matrix_##NumericT, \
117 viennacl::matrix_expression<const matrix_base<NumericT>, const matrix_base<NumericT>, \
118 op_element_unary<OPTAG> >(*x.matrix_##NumericT, *x.matrix_##NumericT)); break;
119
120 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, float, op_abs)
121 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, float, op_acos)
122 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, float, op_asin)
123 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, float, op_atan)
124 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, float, op_ceil)
125 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, float, op_cos)
126 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, float, op_cosh)
127 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, float, op_exp)
128 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, float, op_fabs)
129 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, float, op_floor)
130 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, float, op_log)
131 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, float, op_log10)
132 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, float, op_sin)
133 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, float, op_sinh)
134 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, float, op_sqrt)
135 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, float, op_tan)
136 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, float, op_tanh)
137 default:
138 throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
139 }
140
141 }
142 else if (x.numeric_type == DOUBLE_TYPE)
143 {
144 switch (op_type)
145 {
146 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ABS_TYPE, double, op_abs)
147 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ACOS_TYPE, double, op_acos)
148 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ASIN_TYPE, double, op_asin)
149 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_ATAN_TYPE, double, op_atan)
150 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_CEIL_TYPE, double, op_ceil)
151 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COS_TYPE, double, op_cos)
152 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_COSH_TYPE, double, op_cosh)
153 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_EXP_TYPE, double, op_exp)
154 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FABS_TYPE, double, op_fabs)
155 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_FLOOR_TYPE, double, op_floor)
156 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG_TYPE, double, op_log)
157 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_LOG10_TYPE, double, op_log10)
158 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SIN_TYPE, double, op_sin)
159 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SINH_TYPE, double, op_sinh)
160 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_SQRT_TYPE, double, op_sqrt)
161 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TAN_TYPE, double, op_tan)
162 VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPERATION_UNARY_TANH_TYPE, double, op_tanh)
163 default:
164 throw statement_not_supported_exception("Invalid op_type in unary elementwise operations");
165 }
166 }
167 else
168 throw statement_not_supported_exception("Invalid numeric type in unary elementwise operator");
169
170 #undef VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP
171
172 }
173 }
174
175 // result = element_op(x,y) for vectors or matrices x, y
176 inline void element_op(lhs_rhs_element result,
177 lhs_rhs_element const & x,
178 lhs_rhs_element const & y,
179 operation_node_type op_type)
180 {
181 assert( x.numeric_type == y.numeric_type && bool("Numeric type not the same!"));
182 assert( result.numeric_type == y.numeric_type && bool("Numeric type not the same!"));
183
184 assert( x.type_family == y.type_family && bool("Subtype not the same!"));
185 assert( result.type_family == y.type_family && bool("Subtype not the same!"));
186
187 switch (op_type)
188 {
189
190 case OPERATION_BINARY_ELEMENT_DIV_TYPE:
191 if (x.subtype == DENSE_VECTOR_TYPE)
192 {
193 switch (x.numeric_type)
194 {
195 case FLOAT_TYPE:
196 viennacl::linalg::element_op(*result.vector_float,
197 vector_expression<const vector_base<float>,
198 const vector_base<float>,
199 op_element_binary<op_div> >(*x.vector_float, *y.vector_float));
200 break;
201 case DOUBLE_TYPE:
202 viennacl::linalg::element_op(*result.vector_double,
203 vector_expression<const vector_base<double>,
204 const vector_base<double>,
205 op_element_binary<op_div> >(*x.vector_double, *y.vector_double));
206 break;
207 default:
208 throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
209 }
210 }
211 else if (x.subtype == DENSE_MATRIX_TYPE)
212 {
213 switch (x.numeric_type)
214 {
215 case FLOAT_TYPE:
216 viennacl::linalg::element_op(*result.matrix_float,
217 matrix_expression< const matrix_base<float>,
218 const matrix_base<float>,
219 op_element_binary<op_div> >(*x.matrix_float, *y.matrix_float));
220 break;
221 case DOUBLE_TYPE:
222 viennacl::linalg::element_op(*result.matrix_double,
223 matrix_expression< const matrix_base<double>,
224 const matrix_base<double>,
225 op_element_binary<op_div> >(*x.matrix_double, *y.matrix_double));
226 break;
227 default:
228 throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
229 }
230 }
231 else
232 throw statement_not_supported_exception("Invalid operand type for binary elementwise division");
233 break;
234
235
236 case OPERATION_BINARY_ELEMENT_PROD_TYPE:
237 if (x.subtype == DENSE_VECTOR_TYPE)
238 {
239 switch (x.numeric_type)
240 {
241 case FLOAT_TYPE:
242 viennacl::linalg::element_op(*result.vector_float,
243 vector_expression<const vector_base<float>,
244 const vector_base<float>,
245 op_element_binary<op_prod> >(*x.vector_float, *y.vector_float));
246 break;
247 case DOUBLE_TYPE:
248 viennacl::linalg::element_op(*result.vector_double,
249 vector_expression<const vector_base<double>,
250 const vector_base<double>,
251 op_element_binary<op_prod> >(*x.vector_double, *y.vector_double));
252 break;
253 default:
254 throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
255 }
256 }
257 else if (x.subtype == DENSE_MATRIX_TYPE)
258 {
259 switch (x.numeric_type)
260 {
261 case FLOAT_TYPE:
262 viennacl::linalg::element_op(*result.matrix_float,
263 matrix_expression< const matrix_base<float>,
264 const matrix_base<float>,
265 op_element_binary<op_prod> >(*x.matrix_float, *y.matrix_float));
266 break;
267 case DOUBLE_TYPE:
268 viennacl::linalg::element_op(*result.matrix_double,
269 matrix_expression< const matrix_base<double>,
270 const matrix_base<double>,
271 op_element_binary<op_prod> >(*x.matrix_double, *y.matrix_double));
272 break;
273 default:
274 throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
275 }
276 }
277 else
278 throw statement_not_supported_exception("Invalid operand type for binary elementwise division");
279 break;
280
281
282 case OPERATION_BINARY_ELEMENT_POW_TYPE:
283 if (x.subtype == DENSE_VECTOR_TYPE)
284 {
285 switch (x.numeric_type)
286 {
287 case FLOAT_TYPE:
288 viennacl::linalg::element_op(*result.vector_float,
289 vector_expression<const vector_base<float>,
290 const vector_base<float>,
291 op_element_binary<op_pow> >(*x.vector_float, *y.vector_float));
292 break;
293 case DOUBLE_TYPE:
294 viennacl::linalg::element_op(*result.vector_double,
295 vector_expression<const vector_base<double>,
296 const vector_base<double>,
297 op_element_binary<op_pow> >(*x.vector_double, *y.vector_double));
298 break;
299 default:
300 throw statement_not_supported_exception("Invalid numeric type for binary elementwise division");
301 }
302 }
303 else if (x.subtype == DENSE_MATRIX_TYPE)
304 {
305 switch (x.numeric_type)
306 {
307 case FLOAT_TYPE:
308 viennacl::linalg::element_op(*result.matrix_float,
309 matrix_expression< const matrix_base<float>,
310 const matrix_base<float>,
311 op_element_binary<op_pow> >(*x.matrix_float, *y.matrix_float));
312 break;
313 case DOUBLE_TYPE:
314 viennacl::linalg::element_op(*result.matrix_double,
315 matrix_expression< const matrix_base<double>,
316 const matrix_base<double>,
317 op_element_binary<op_pow> >(*x.matrix_double, *y.matrix_double));
318 break;
319 default:
320 throw statement_not_supported_exception("Invalid numeric type for binary elementwise power");
321 }
322 }
323 else
324 throw statement_not_supported_exception("Invalid operand type for binary elementwise power");
325 break;
326
327 default:
328 throw statement_not_supported_exception("Invalid operation type for binary elementwise operations");
329 }
330 }
331 }
332
334 inline void execute_element_composite(statement const & s, statement_node const & root_node)
335 {
336 statement_node const & leaf = s.array()[root_node.rhs.node_index];
337 viennacl::context ctx = detail::extract_context(root_node);
338
339 statement_node new_root_lhs;
340 statement_node new_root_rhs;
341
342 // check for temporary on lhs:
343 if (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY)
344 {
345 detail::new_element(new_root_lhs.lhs, root_node.lhs, ctx);
346
347 new_root_lhs.op.type_family = OPERATION_BINARY_TYPE_FAMILY;
348 new_root_lhs.op.type = OPERATION_BINARY_ASSIGN_TYPE;
349
350 new_root_lhs.rhs.type_family = COMPOSITE_OPERATION_FAMILY;
351 new_root_lhs.rhs.subtype = INVALID_SUBTYPE;
352 new_root_lhs.rhs.numeric_type = INVALID_NUMERIC_TYPE;
353 new_root_lhs.rhs.node_index = leaf.lhs.node_index;
354
355 // work on subexpression:
356 // TODO: Catch exception, free temporary, then rethrow
357 detail::execute_composite(s, new_root_lhs);
358 }
359
360 if (leaf.op.type == OPERATION_BINARY_ELEMENT_PROD_TYPE || leaf.op.type == OPERATION_BINARY_ELEMENT_DIV_TYPE || leaf.op.type == OPERATION_BINARY_ELEMENT_POW_TYPE)
361 {
362 // check for temporary on rhs:
363 if (leaf.rhs.type_family == COMPOSITE_OPERATION_FAMILY)
364 {
365 detail::new_element(new_root_rhs.lhs, root_node.lhs, ctx);
366
367 new_root_rhs.op.type_family = OPERATION_BINARY_TYPE_FAMILY;
368 new_root_rhs.op.type = OPERATION_BINARY_ASSIGN_TYPE;
369
370 new_root_rhs.rhs.type_family = COMPOSITE_OPERATION_FAMILY;
371 new_root_rhs.rhs.subtype = INVALID_SUBTYPE;
372 new_root_rhs.rhs.numeric_type = INVALID_NUMERIC_TYPE;
373 new_root_rhs.rhs.node_index = leaf.rhs.node_index;
374
375 // work on subexpression:
376 // TODO: Catch exception, free temporary, then rethrow
377 detail::execute_composite(s, new_root_rhs);
378 }
379
380 lhs_rhs_element x = (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY) ? new_root_lhs.lhs : leaf.lhs;
381 lhs_rhs_element y = (leaf.rhs.type_family == COMPOSITE_OPERATION_FAMILY) ? new_root_rhs.lhs : leaf.rhs;
382
383 // compute element-wise operation:
384 detail::element_op(root_node.lhs, x, y, leaf.op.type);
385
386 if (leaf.rhs.type_family == COMPOSITE_OPERATION_FAMILY)
387 detail::delete_element(new_root_rhs.lhs);
388 }
389 else if (leaf.op.type_family == OPERATION_UNARY_TYPE_FAMILY)
390 {
391 lhs_rhs_element x = (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY) ? new_root_lhs.lhs : leaf.lhs;
392
393 // compute element-wise operation:
394 detail::element_op(root_node.lhs, x, leaf.op.type);
395 }
396 else
397 throw statement_not_supported_exception("Unsupported elementwise operation.");
398
399 // clean up:
400 if (leaf.lhs.type_family == COMPOSITE_OPERATION_FAMILY)
401 detail::delete_element(new_root_lhs.lhs);
402
403 }
404
405
406 } // namespace scheduler
407 } // namespace viennacl
408
409 #endif
410
viennacl::scheduler::OPERATION_UNARY_ATAN_TYPE
Definition: forwards.h:91
viennacl::op_cosh
A tag class representing the cosh() function.
Definition: forwards.h:155
viennacl::op_tan
A tag class representing the tan() function.
Definition: forwards.h:181
viennacl::scheduler::OPERATION_BINARY_ELEMENT_POW_TYPE
Definition: forwards.h:134
VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP
#define VIENNACL_SCHEDULER_GENERATE_UNARY_ELEMENT_OP(OPNAME, NumericT, OPTAG)
matrix_operations.hpp
Implementations of dense matrix related operations including matrix-vector products.
viennacl::scheduler::OPERATION_UNARY_COS_TYPE
Definition: forwards.h:93
vector_operations.hpp
Implementations of vector operations.
viennacl::scheduler::OPERATION_UNARY_FABS_TYPE
Definition: forwards.h:96
viennacl::scheduler::detail::extract_context
viennacl::context extract_context(statement_node const &root_node)
Helper routine for extracting the context in which a statement is executed.
Definition: execute_util.hpp:105
viennacl::scheduler::DENSE_VECTOR_TYPE
Definition: forwards.h:271
viennacl::scheduler::OPERATION_BINARY_ELEMENT_DIV_TYPE
Definition: forwards.h:127
viennacl::scheduler::DOUBLE_TYPE
Definition: forwards.h:300
viennacl::scheduler::INVALID_SUBTYPE
Definition: forwards.h:266
viennacl::scheduler::OPERATION_UNARY_ACOS_TYPE
Definition: forwards.h:89
viennacl::scheduler::OPERATION_UNARY_EXP_TYPE
Definition: forwards.h:95
viennacl::matrix_base< float >
viennacl::op_abs
A tag class representing the modulus function for integers.
Definition: forwards.h:137
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::op_ceil
A tag class representing the ceil() function.
Definition: forwards.h:151
viennacl::scheduler::OPERATION_UNARY_ASIN_TYPE
Definition: forwards.h:90
viennacl::scheduler::statement_node::op
op_element op
Definition: forwards.h:481
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::scheduler::lhs_rhs_element::type_family
statement_node_type_family type_family
Definition: forwards.h:339
viennacl::scheduler::OPERATION_BINARY_ASSIGN_TYPE
Definition: forwards.h:115
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::statement::array
container_type const & array() const
Definition: forwards.h:528
viennacl::scheduler::execute_element_composite
void execute_element_composite(statement const &s, statement_node const &root_node)
Deals with x = RHS where RHS is a vector expression.
Definition: execute_elementwise.hpp:334
viennacl::vector_expression
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:239
viennacl::linalg::element_op
void element_op(matrix_base< T > &A, matrix_expression< const matrix_base< T >, const matrix_base< T >, OP > const &proxy)
Implementation of the element-wise operation A = B .* C and A = B ./ C for matrices (using MATLAB syn...
Definition: matrix_operations.hpp:702
viennacl::op_log
A tag class representing the log() function.
Definition: forwards.h:171
viennacl::scheduler::op_element::type_family
operation_node_type_family type_family
Definition: forwards.h:473
viennacl::op_tanh
A tag class representing the tanh() function.
Definition: forwards.h:183
viennacl::scheduler::OPERATION_BINARY_ELEMENT_PROD_TYPE
Definition: forwards.h:126
viennacl::op_fabs
A tag class representing the fabs() function.
Definition: forwards.h:159
viennacl::scheduler::lhs_rhs_element::matrix_double
viennacl::matrix_base< double > * matrix_double
Definition: forwards.h:410
viennacl::scheduler::detail::delete_element
void delete_element(lhs_rhs_element &elem)
Definition: execute_util.hpp:266
viennacl::context
Represents a generic 'context' similar to an OpenCL context, but is backend-agnostic and thus also su...
Definition: context.hpp:39
viennacl::scheduler::COMPOSITE_OPERATION_FAMILY
Definition: forwards.h:251
viennacl::op_atan
A tag class representing the atan() function.
Definition: forwards.h:147
viennacl::op_sinh
A tag class representing the sinh() function.
Definition: forwards.h:177
viennacl::scheduler::DENSE_MATRIX_TYPE
Definition: forwards.h:274
viennacl::scheduler::OPERATION_UNARY_LOG_TYPE
Definition: forwards.h:98
viennacl::scheduler::OPERATION_UNARY_SQRT_TYPE
Definition: forwards.h:102
viennacl::op_exp
A tag class representing the exp() function.
Definition: forwards.h:157
viennacl::scheduler::INVALID_NUMERIC_TYPE
Definition: forwards.h:288
viennacl::scheduler::OPERATION_UNARY_SINH_TYPE
Definition: forwards.h:101
viennacl::scheduler::lhs_rhs_element::numeric_type
statement_node_numeric_type numeric_type
Definition: forwards.h:341
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_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::vector_base< float >
viennacl::op_sqrt
A tag class representing the sqrt() function.
Definition: forwards.h:179
viennacl::scheduler::OPERATION_UNARY_ABS_TYPE
Definition: forwards.h:88
viennacl::scheduler::statement_node::lhs
lhs_rhs_element lhs
Definition: forwards.h:480
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
forwards.h
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
viennacl::scheduler::OPERATION_UNARY_LOG10_TYPE
Definition: forwards.h:99
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_node_type
operation_node_type
Enumeration for identifying the possible operations.
Definition: forwards.h:68
viennacl::op_sin
A tag class representing the sin() function.
Definition: forwards.h:175
viennacl::scheduler::detail::new_element
void new_element(lhs_rhs_element &new_elem, lhs_rhs_element const &old_element, viennacl::context const &ctx)
Definition: execute_util.hpp:204
viennacl::op_floor
A tag class representing the floor() function.
Definition: forwards.h:163
viennacl::scheduler::OPERATION_UNARY_TAN_TYPE
Definition: forwards.h:103
viennacl::op_asin
A tag class representing the asin() function.
Definition: forwards.h:141
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_UNARY_TANH_TYPE
Definition: forwards.h:104
viennacl::scheduler::FLOAT_TYPE
Definition: forwards.h:299
viennacl::op_element_binary
A tag class representing element-wise binary operations (like multiplication) on vectors or matrices...
Definition: forwards.h:130
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::node_index
vcl_size_t node_index
Definition: forwards.h:346
viennacl::op_acos
A tag class representing the acos() function.
Definition: forwards.h:139
viennacl::op_log10
A tag class representing the log10() function.
Definition: forwards.h:173
viennacl::scheduler::OPERATION_UNARY_COSH_TYPE
Definition: forwards.h:94
viennacl::scheduler::detail::element_op
void element_op(lhs_rhs_element result, lhs_rhs_element const &x, operation_node_type op_type)
Definition: execute_elementwise.hpp:39
execute_util.hpp
Provides various utilities for implementing the execution of statements.
viennacl::op_cos
A tag class representing the cos() function.
Definition: forwards.h:153
viennacl::scheduler::statement_node
Main datastructure for an node in the statement tree.
Definition: forwards.h:478
viennacl::scheduler::statement_not_supported_exception
Exception for the case the scheduler is unable to deal with the operation.
Definition: forwards.h:38
viennacl::scheduler::OPERATION_UNARY_TYPE_FAMILY
Definition: forwards.h:58