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
preset.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_SCHEDULER_PRESET_HPP_
2 #define VIENNACL_SCHEDULER_PRESET_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 
24 
25 namespace viennacl
26 {
27 namespace scheduler
28 {
29 namespace preset
30 {
31 
32 template<typename NumericT>
34  viennacl::matrix_base<NumericT> const * B, bool B_trans,
36 {
37  vcl_size_t dummy = 0;
39 
40  scheduler::statement::add_element(dummy, array[0].lhs, *C);
41  array[0].op.type_family = OPERATION_BINARY_TYPE_FAMILY;
42  array[0].op.type = OPERATION_BINARY_ASSIGN_TYPE;
43  array[0].rhs.type_family = COMPOSITE_OPERATION_FAMILY;
44  array[0].rhs.node_index = 1;
45 
46  array[1].lhs.type_family = COMPOSITE_OPERATION_FAMILY;
47  array[1].lhs.node_index = 2;
48  array[1].op.type_family = OPERATION_BINARY_TYPE_FAMILY;
49  array[1].op.type = OPERATION_BINARY_ADD_TYPE;
50  array[1].rhs.type_family = COMPOSITE_OPERATION_FAMILY;
51  array[1].rhs.node_index = 6;
52 
53  array[2].lhs.type_family = COMPOSITE_OPERATION_FAMILY;
54  array[2].lhs.node_index = 3;
55  array[2].op.type_family = OPERATION_BINARY_TYPE_FAMILY;
56  array[2].op.type = OPERATION_BINARY_MULT_TYPE;
57  scheduler::statement::add_element(dummy, array[2].rhs, alpha);
58 
59 
60  if (A_trans)
61  {
62  array[3].lhs.type_family = COMPOSITE_OPERATION_FAMILY;
63  array[3].lhs.node_index = 4;
64 
65  statement::add_element(dummy, array[4].lhs, *A);
66  array[4].op.type_family = OPERATION_UNARY_TYPE_FAMILY;
67  array[4].op.type = OPERATION_UNARY_TRANS_TYPE;
68  }
69  else
70  {
71  statement::add_element(dummy, array[3].lhs, *A);
72  }
73 
74  array[3].op.type_family = OPERATION_BINARY_TYPE_FAMILY;
75  array[3].op.type = OPERATION_BINARY_MAT_MAT_PROD_TYPE;
76 
77  if (B_trans)
78  {
79  array[3].rhs.type_family = COMPOSITE_OPERATION_FAMILY;
80  array[3].rhs.node_index = 5;
81 
82  statement::add_element(dummy, array[5].lhs, *B);
83  array[5].op.type_family = OPERATION_UNARY_TYPE_FAMILY;
84  array[5].op.type = OPERATION_UNARY_TRANS_TYPE;
85  }
86  else
87  {
88  statement::add_element(dummy, array[3].rhs, *B);
89  }
90 
91  scheduler::statement::add_element(dummy, array[6].rhs, *C);
92  array[6].op.type_family = OPERATION_BINARY_TYPE_FAMILY;
93  array[6].op.type = OPERATION_BINARY_MULT_TYPE;
94  scheduler::statement::add_element(dummy, array[6].rhs, beta);
95 
96 
97 
98  return statement(array);
99 }
100 
101 }
102 }
103 }
104 
105 #endif
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
float NumericT
Definition: bisect.cpp:40
std::vector< value_type > container_type
Definition: forwards.h:507
Forwards declaration.
std::size_t vcl_size_t
Definition: forwards.h:75
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
statement mat_mat_prod(NumericT alpha, viennacl::matrix_base< NumericT > const *A, bool A_trans, viennacl::matrix_base< NumericT > const *B, bool B_trans, NumericT beta, viennacl::matrix_base< NumericT > const *C)
Definition: preset.hpp:33
The main class for representing a statement such as x = inner_prod(y,z); at runtime.
Definition: forwards.h:502