ViennaCL - The Vienna Computing Library  1.6.2
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-2014, 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 PDF manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
21 
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:
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 
47 private:
48  std::string message_;
49 };
50 
51 
54 {
56 
57  // unary or binary expression
60 
61  //reductions
65 };
66 
69 {
71 
72  // unary operator
74 
75  // unary expression
87 
105 
112 
113  // binary expression
120  OPERATION_BINARY_MULT_TYPE, // scalar times vector/matrix
121  OPERATION_BINARY_DIV_TYPE, // vector/matrix divided by scalar
139 
147 
148 };
149 
150 
151 
152 namespace result_of
153 {
154  template<typename T>
156  {
157  typedef typename T::ERROR_UNKNOWN_OP_TYPE error_type;
158  };
159 
160  // elementwise casts
161  template<> struct op_type_info<op_element_cast<char> > { enum { id = OPERATION_UNARY_CAST_CHAR_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
162  template<> struct op_type_info<op_element_cast<unsigned char> > { enum { id = OPERATION_UNARY_CAST_UCHAR_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
163  template<> struct op_type_info<op_element_cast<short> > { enum { id = OPERATION_UNARY_CAST_SHORT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
164  template<> struct op_type_info<op_element_cast<unsigned short> > { enum { id = OPERATION_UNARY_CAST_USHORT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
165  template<> struct op_type_info<op_element_cast<int> > { enum { id = OPERATION_UNARY_CAST_INT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
166  template<> struct op_type_info<op_element_cast<unsigned int> > { enum { id = OPERATION_UNARY_CAST_UINT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
167  template<> struct op_type_info<op_element_cast<long> > { enum { id = OPERATION_UNARY_CAST_LONG_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
168  template<> struct op_type_info<op_element_cast<unsigned long> > { enum { id = OPERATION_UNARY_CAST_ULONG_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
169  template<> struct op_type_info<op_element_cast<float> > { enum { id = OPERATION_UNARY_CAST_FLOAT_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
170  template<> struct op_type_info<op_element_cast<double> > { enum { id = OPERATION_UNARY_CAST_DOUBLE_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
171 
172  // elementwise functions
190 
202 
203 
204  //structurewise function
205  template<> struct op_type_info<op_norm_1 > { enum { id = OPERATION_UNARY_NORM_1_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
206  template<> struct op_type_info<op_norm_2 > { enum { id = OPERATION_UNARY_NORM_2_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
208  template<> struct op_type_info<op_max > { enum { id = OPERATION_UNARY_MAX_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
209  template<> struct op_type_info<op_min > { enum { id = OPERATION_UNARY_MIN_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
210 
211  template<> struct op_type_info<op_trans > { enum { id = OPERATION_UNARY_TRANS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
212  template<> struct op_type_info<op_row > { enum { id = OPERATION_BINARY_MATRIX_ROW_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
214 
217 
221 
222  template<typename OP> struct op_type_info<op_reduce_vector<OP> > { enum { id = op_type_info<OP>::id, family = OPERATION_VECTOR_REDUCTION_TYPE_FAMILY}; };
223  template<typename OP> struct op_type_info<op_reduce_rows<OP> > { enum { id = op_type_info<OP>::id, family = OPERATION_ROWS_REDUCTION_TYPE_FAMILY}; };
224  template<typename OP> struct op_type_info<op_reduce_columns<OP> > { enum { id = op_type_info<OP>::id, family = OPERATION_COLUMNS_REDUCTION_TYPE_FAMILY}; };
225 
226  //elementwise operator
227  template<> struct op_type_info<op_assign> { enum { id = OPERATION_BINARY_ASSIGN_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
230  template<> struct op_type_info<op_add> { enum { id = OPERATION_BINARY_ADD_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
231  template<> struct op_type_info<op_sub> { enum { id = OPERATION_BINARY_SUB_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
234  template<> struct op_type_info<op_mult> { enum { id = OPERATION_BINARY_MULT_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
235  template<> struct op_type_info<op_div> { enum { id = OPERATION_BINARY_DIV_TYPE, family = OPERATION_BINARY_TYPE_FAMILY}; };
236 
237  template<> struct op_type_info<op_flip_sign> { enum { id = OPERATION_UNARY_MINUS_TYPE, family = OPERATION_UNARY_TYPE_FAMILY}; };
238 
239 
241 } // namespace result_of
242 
243 
244 
245 
246 
249 {
251 
252  // LHS or RHS are again an expression:
254 
255  // device scalars:
257 
258  // vector:
260 
261  // matrices:
263 };
264 
267 {
268  INVALID_SUBTYPE = 0, //when type is COMPOSITE_OPERATION_FAMILY
269 
272 
275 
278 
283 
284  // other matrix types to be added here
285 };
286 
289 {
290  INVALID_NUMERIC_TYPE = 0, //when type is COMPOSITE_OPERATION_FAMILY
291 
303 };
304 
305 
306 namespace result_of
307 {
309 
311  template<typename T>
312  struct numeric_type_id {};
313 
316  template<> struct numeric_type_id<char> { enum { value = CHAR_TYPE }; };
317  template<> struct numeric_type_id<unsigned char> { enum { value = UCHAR_TYPE }; };
318  template<> struct numeric_type_id<short> { enum { value = SHORT_TYPE }; };
319  template<> struct numeric_type_id<unsigned short> { enum { value = USHORT_TYPE }; };
320  template<> struct numeric_type_id<int> { enum { value = INT_TYPE }; };
321  template<> struct numeric_type_id<unsigned int> { enum { value = UINT_TYPE }; };
322  template<> struct numeric_type_id<long> { enum { value = LONG_TYPE }; };
323  template<> struct numeric_type_id<unsigned long> { enum { value = ULONG_TYPE }; };
324  template<> struct numeric_type_id<float> { enum { value = FLOAT_TYPE }; };
325  template<> struct numeric_type_id<double> { enum { value = DOUBLE_TYPE }; };
326 
328 }
329 
330 
331 
340 {
344 
345  union
346  {
349 
351 
352  // host scalars:
353  char host_char;
354  unsigned char host_uchar;
355  short host_short;
356  unsigned short host_ushort;
357  int host_int;
358  unsigned int host_uint;
359  long host_long;
360  unsigned long host_ulong;
361  float host_float;
362  double host_double;
363 
364  // Note: ViennaCL types have potentially expensive copy-CTORs, hence using pointers:
365 
366  // scalars:
377 
378  // vectors:
389 
390  // implicit vectors:
401 
402  // dense matrices:
413 
424 
425  //viennacl::compressed_matrix<float> *compressed_matrix_char;
426  //viennacl::compressed_matrix<double> *compressed_matrix_uchar;
427  //viennacl::compressed_matrix<float> *compressed_matrix_short;
428  //viennacl::compressed_matrix<double> *compressed_matrix_ushort;
429  //viennacl::compressed_matrix<float> *compressed_matrix_int;
430  //viennacl::compressed_matrix<double> *compressed_matrix_uint;
431  //viennacl::compressed_matrix<float> *compressed_matrix_long;
432  //viennacl::compressed_matrix<double> *compressed_matrix_ulong;
435 
436  //viennacl::coordinate_matrix<float> *coordinate_matrix_char;
437  //viennacl::coordinate_matrix<double> *coordinate_matrix_uchar;
438  //viennacl::coordinate_matrix<float> *coordinate_matrix_short;
439  //viennacl::coordinate_matrix<double> *coordinate_matrix_ushort;
440  //viennacl::coordinate_matrix<float> *coordinate_matrix_int;
441  //viennacl::coordinate_matrix<double> *coordinate_matrix_uint;
442  //viennacl::coordinate_matrix<float> *coordinate_matrix_long;
443  //viennacl::coordinate_matrix<double> *coordinate_matrix_ulong;
446 
447  //viennacl::ell_matrix<float> *ell_matrix_char;
448  //viennacl::ell_matrix<double> *ell_matrix_uchar;
449  //viennacl::ell_matrix<float> *ell_matrix_short;
450  //viennacl::ell_matrix<double> *ell_matrix_ushort;
451  //viennacl::ell_matrix<float> *ell_matrix_int;
452  //viennacl::ell_matrix<double> *ell_matrix_uint;
453  //viennacl::ell_matrix<float> *ell_matrix_long;
454  //viennacl::ell_matrix<double> *ell_matrix_ulong;
457 
458  //viennacl::hyb_matrix<float> *hyb_matrix_char;
459  //viennacl::hyb_matrix<double> *hyb_matrix_uchar;
460  //viennacl::hyb_matrix<float> *hyb_matrix_short;
461  //viennacl::hyb_matrix<double> *hyb_matrix_ushort;
462  //viennacl::hyb_matrix<float> *hyb_matrix_int;
463  //viennacl::hyb_matrix<double> *hyb_matrix_uint;
464  //viennacl::hyb_matrix<float> *hyb_matrix_long;
465  //viennacl::hyb_matrix<double> *hyb_matrix_ulong;
468  };
469 };
470 
471 
474 {
477 };
478 
481 {
485 };
486 
487 namespace result_of
488 {
489 
490  template<class T> struct num_nodes { enum { value = 0 }; };
491  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 }; };
492  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 }; };
493  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 }; };
494  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 }; };
495  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 }; };
496  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 }; };
497 
498 }
499 
505 {
506 public:
509  typedef std::vector<value_type> container_type;
510 
511  statement(container_type const & custom_array) : array_(custom_array) {}
512 
516  template<typename LHS, typename OP, typename RHS>
517  statement(LHS & lhs, OP const &, RHS const & rhs) : array_(1 + result_of::num_nodes<RHS>::value)
518  {
519  // set OP:
522 
523  // set LHS:
524  add_lhs(0, 1, lhs);
525 
526  // set RHS:
527  add_rhs(0, 1, rhs);
528  }
529 
530  container_type const & array() const { return array_; }
531 
532  size_type root() const { return 0; }
533 
536 
537  static void assign_element(lhs_rhs_element & elem, char const & t) { elem.host_char = t; }
538  static void assign_element(lhs_rhs_element & elem, unsigned char const & t) { elem.host_uchar = t; }
539  static void assign_element(lhs_rhs_element & elem, short const & t) { elem.host_short = t; }
540  static void assign_element(lhs_rhs_element & elem, unsigned short const & t) { elem.host_ushort = t; }
541  static void assign_element(lhs_rhs_element & elem, int const & t) { elem.host_int = t; }
542  static void assign_element(lhs_rhs_element & elem, unsigned int const & t) { elem.host_uint = t; }
543  static void assign_element(lhs_rhs_element & elem, long const & t) { elem.host_long = t; }
544  static void assign_element(lhs_rhs_element & elem, unsigned long const & t) { elem.host_ulong = t; }
545  static void assign_element(lhs_rhs_element & elem, float const & t) { elem.host_float = t; }
546  static void assign_element(lhs_rhs_element & elem, double const & t) { elem.host_double = t; }
547 
548  static void assign_element(lhs_rhs_element & elem, viennacl::scalar<char> const & t) { elem.scalar_char = const_cast<viennacl::scalar<char> *>(&t); }
550  static void assign_element(lhs_rhs_element & elem, viennacl::scalar<short> const & t) { elem.scalar_short = const_cast<viennacl::scalar<short> *>(&t); }
552  static void assign_element(lhs_rhs_element & elem, viennacl::scalar<int> const & t) { elem.scalar_int = const_cast<viennacl::scalar<int> *>(&t); }
554  static void assign_element(lhs_rhs_element & elem, viennacl::scalar<long> const & t) { elem.scalar_long = const_cast<viennacl::scalar<long> *>(&t); }
556  static void assign_element(lhs_rhs_element & elem, viennacl::scalar<float> const & t) { elem.scalar_float = const_cast<viennacl::scalar<float> *>(&t); }
557  static void assign_element(lhs_rhs_element & elem, viennacl::scalar<double> const & t) { elem.scalar_double = const_cast<viennacl::scalar<double> *>(&t); }
558 
560  static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<char> const & t) { elem.vector_char = const_cast<viennacl::vector_base<char> *>(&t); }
562  static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<short> const & t) { elem.vector_short = const_cast<viennacl::vector_base<short> *>(&t); }
564  static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<int> const & t) { elem.vector_int = const_cast<viennacl::vector_base<int> *>(&t); }
566  static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<long> const & t) { elem.vector_long = const_cast<viennacl::vector_base<long> *>(&t); }
568  static void assign_element(lhs_rhs_element & elem, viennacl::vector_base<float> const & t) { elem.vector_float = const_cast<viennacl::vector_base<float> *>(&t); }
570 
581 
583  // TODO: add integer matrix overloads here
584  static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<char> const & t) { elem.matrix_char = const_cast<viennacl::matrix_base<char> *>(&t); }
586  static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<short> const & t) { elem.matrix_short = const_cast<viennacl::matrix_base<short> *>(&t); }
588  static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<int> const & t) { elem.matrix_int = const_cast<viennacl::matrix_base<int> *>(&t); }
590  static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<long> const & t) { elem.matrix_long = const_cast<viennacl::matrix_base<long> *>(&t); }
592  static void assign_element(lhs_rhs_element & elem, viennacl::matrix_base<float> const & t) { elem.matrix_float = const_cast<viennacl::matrix_base<float> *>(&t); }
594 
605 
608 
611 
614 
617 
619 
620  template<class T>
623  lhs_rhs_element & elem,
624  T const & t)
625  {
627  elem.subtype = HOST_SCALAR_TYPE;
629  assign_element(elem, t);
630  return next_free;
631  }
632 
633  template<typename T>
635  lhs_rhs_element & elem,
636  viennacl::scalar<T> const & t)
637  {
641  assign_element(elem, t);
642  return next_free;
643  }
644 
645 
646  template<typename T>
648  lhs_rhs_element & elem,
649  viennacl::vector_base<T> const & t)
650  {
652  elem.subtype = DENSE_VECTOR_TYPE;
654  assign_element(elem, t);
655  return next_free;
656  }
657 
658  template<typename T>
660  lhs_rhs_element & elem,
662  {
666  assign_element(elem, t);
667  return next_free;
668  }
669 
670  template<typename T>
672  lhs_rhs_element & elem,
673  viennacl::matrix_base<T> const & t)
674  {
676  elem.subtype = DENSE_MATRIX_TYPE;
678  assign_element(elem, t);
679  return next_free;
680  }
681 
682  template<typename T>
684  lhs_rhs_element & elem,
686  {
690  assign_element(elem, t);
691  return next_free;
692  }
693 
694  template<typename T>
696  lhs_rhs_element & elem,
698  {
702  assign_element(elem, t);
703  return next_free;
704  }
705 
706  template<typename T>
708  lhs_rhs_element & elem,
710  {
714  assign_element(elem, t);
715  return next_free;
716  }
717 
718  template<typename T>
720  lhs_rhs_element & elem,
721  viennacl::ell_matrix<T> const & t)
722  {
724  elem.subtype = ELL_MATRIX_TYPE;
726  assign_element(elem, t);
727  return next_free;
728  }
729 
730  template<typename T>
732  lhs_rhs_element & elem,
733  viennacl::hyb_matrix<T> const & t)
734  {
736  elem.subtype = HYB_MATRIX_TYPE;
738  assign_element(elem, t);
739  return next_free;
740  }
741 
742 private:
743 
745 
746  template<typename LHS, typename RHS, typename OP>
748  lhs_rhs_element & elem,
750  {
752  elem.subtype = INVALID_SUBTYPE;
754  elem.node_index = next_free;
755  return add_node(next_free, next_free + 1, t);
756  }
757 
758  template<typename LHS, typename RHS, typename OP>
760  lhs_rhs_element & elem,
762  {
763  elem.type_family = COMPOSITE_OPERATION_FAMILY;
764  elem.subtype = INVALID_SUBTYPE;
765  elem.numeric_type = INVALID_NUMERIC_TYPE;
766  elem.node_index = next_free;
767  return add_node(next_free, next_free + 1, t);
768  }
769 
770  template<typename LHS, typename RHS, typename OP>
772  lhs_rhs_element & elem,
774  {
775  elem.type_family = COMPOSITE_OPERATION_FAMILY;
776  elem.subtype = INVALID_SUBTYPE;
777  elem.numeric_type = INVALID_NUMERIC_TYPE;
778  elem.node_index = next_free;
779  return add_node(next_free, next_free + 1, t);
780  }
781 
783 
784 
785  template<typename T>
786  vcl_size_t add_lhs(vcl_size_t current_index, vcl_size_t next_free, T const & t)
787  {
788  return add_element(next_free, array_[current_index].lhs, t);
789  }
790 
791  template<typename T>
792  vcl_size_t add_rhs(vcl_size_t current_index, vcl_size_t next_free, T const & t)
793  {
794  return add_element(next_free, array_[current_index].rhs, t);
795  }
796 
798 
799  template<template<typename, typename, typename> class ExpressionT, typename LHS, typename RHS, typename OP>
800  vcl_size_t add_node(vcl_size_t current_index, vcl_size_t next_free, ExpressionT<LHS, RHS, OP> const & proxy)
801  {
802  // set OP:
803  array_[current_index].op.type_family = operation_node_type_family(result_of::op_type_info<OP>::family);
804  array_[current_index].op.type = operation_node_type(result_of::op_type_info<OP>::id);
805 
806  // set LHS and RHS:
807  if (array_[current_index].op.type_family == OPERATION_UNARY_TYPE_FAMILY)
808  {
809  // unary expression: set rhs to invalid:
810  array_[current_index].rhs.type_family = INVALID_TYPE_FAMILY;
811  array_[current_index].rhs.subtype = INVALID_SUBTYPE;
812  array_[current_index].rhs.numeric_type = INVALID_NUMERIC_TYPE;
813  return add_lhs(current_index, next_free, proxy.lhs());
814  }
815 
816  return add_rhs(current_index, add_lhs(current_index, next_free, proxy.lhs()), proxy.rhs());
817  }
818 
819  container_type array_;
820 };
821 
822 namespace detail
823 {
825  inline void execute_composite(statement const & /* s */, statement_node const & /* root_node */);
826 }
827 
828 } // namespace scheduler
829 } // namespace viennacl
830 
831 #endif
832 
Simple enable-if variant that uses the SFINAE pattern.
Definition: enable_if.hpp:30
static void assign_element(lhs_rhs_element &elem, unsigned short const &t)
Definition: forwards.h:540
A tag class representing multiplication by a scalar.
Definition: forwards.h:91
A tag class representing the cosh() function.
Definition: forwards.h:154
viennacl::implicit_vector_base< float > * implicit_vector_float
Definition: forwards.h:399
A tag class representing equality.
Definition: forwards.h:102
A tag class representing the tan() function.
Definition: forwards.h:180
viennacl::scalar< float > * scalar_float
Definition: forwards.h:375
viennacl::vector_base< unsigned short > * vector_ushort
Definition: forwards.h:382
viennacl::implicit_vector_base< int > * implicit_vector_int
Definition: forwards.h:395
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< char > const &t)
Definition: forwards.h:571
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< float > const &t)
Definition: forwards.h:556
viennacl::vector_base< unsigned int > * vector_uint
Definition: forwards.h:384
viennacl::implicit_vector_base< unsigned char > * implicit_vector_uchar
Definition: forwards.h:392
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned char > const &t)
Definition: forwards.h:572
viennacl::matrix_base< short > * matrix_short
Definition: forwards.h:405
A tag class representing less-than.
Definition: forwards.h:108
viennacl::vector_base< short > * vector_short
Definition: forwards.h:381
viennacl::scalar< short > * scalar_short
Definition: forwards.h:369
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< short > const &t)
Definition: forwards.h:586
statement(LHS &lhs, OP const &, RHS const &rhs)
Generate the runtime statement from an expression template.
Definition: forwards.h:517
viennacl::matrix_base< char > * matrix_char
Definition: forwards.h:403
A tag class representing the extraction of a matrix column to a vector.
Definition: forwards.h:194
viennacl::implicit_matrix_base< unsigned long > * implicit_matrix_ulong
Definition: forwards.h:421
A tag class representing a matrix given by a vector placed on a certain (off-)diagonal.
Definition: forwards.h:188
static void assign_element(lhs_rhs_element &elem, char const &t)
Definition: forwards.h:537
static void assign_element(lhs_rhs_element &elem, double const &t)
Definition: forwards.h:546
A tag class representing subtraction.
Definition: forwards.h:89
static void assign_element(lhs_rhs_element &elem, viennacl::hyb_matrix< float > const &m)
Definition: forwards.h:615
A tag class representing assignment.
Definition: forwards.h:80
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned char > const &t)
Definition: forwards.h:585
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned long > const &t)
Definition: forwards.h:602
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< short > const &t)
Definition: forwards.h:597
A tag class representing the modulus function for integers.
Definition: forwards.h:136
viennacl::vector_base< int > * vector_int
Definition: forwards.h:383
statement_node_subtype subtype
Definition: forwards.h:342
Expression template class for representing a tree of expressions which ultimately result in a matrix...
Definition: forwards.h:340
A tag class representing the ceil() function.
Definition: forwards.h:150
static void assign_element(lhs_rhs_element &elem, unsigned char const &t)
Definition: forwards.h:538
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< short > const &t)
Definition: forwards.h:562
viennacl::vcl_size_t size_type
Definition: forwards.h:508
T::ERROR_UNKNOWN_OP_TYPE error_type
Definition: forwards.h:157
viennacl::coordinate_matrix< double > * coordinate_matrix_double
Definition: forwards.h:445
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< long > const &t)
Definition: forwards.h:590
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::implicit_vector_base< long > * implicit_vector_long
Definition: forwards.h:397
statement_node_type_family type_family
Definition: forwards.h:341
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned int > const &t)
Definition: forwards.h:553
viennacl::implicit_matrix_base< double > * implicit_matrix_double
Definition: forwards.h:423
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned short > const &t)
Definition: forwards.h:587
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned short > const &t)
Definition: forwards.h:563
A tag class representing division.
Definition: forwards.h:97
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< double > const &t)
Definition: forwards.h:569
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< long > const &t)
Definition: forwards.h:601
A class representing the 'data' for the LHS or RHS operand of the respective node.
Definition: forwards.h:339
viennacl::matrix_base< unsigned char > * matrix_uchar
Definition: forwards.h:404
container_type const & array() const
Definition: forwards.h:530
viennacl::scalar< unsigned int > * scalar_uint
Definition: forwards.h:372
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< char > const &t)
Definition: forwards.h:595
viennacl::scalar< long > * scalar_long
Definition: forwards.h:373
statement_node_numeric_type
Encodes the type of a node in the statement tree.
Definition: forwards.h:288
static void assign_element(lhs_rhs_element &elem, float const &t)
Definition: forwards.h:545
A proxy for scalar expressions (e.g. from inner vector products)
Definition: forwards.h:229
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:238
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:622
static void assign_element(lhs_rhs_element &elem, viennacl::ell_matrix< float > const &m)
Definition: forwards.h:612
A tag class representing the log() function.
Definition: forwards.h:170
operation_node_type_family type_family
Definition: forwards.h:475
Struct for holding the type family as well as the type of an operation (could be addition, subtraction, norm, etc.)
Definition: forwards.h:473
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< char > const &t)
Definition: forwards.h:560
A tag class representing inplace addition.
Definition: forwards.h:82
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned int > const &t)
Definition: forwards.h:576
A tag class representing the tanh() function.
Definition: forwards.h:182
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::matrix_base< T > const &t)
Definition: forwards.h:671
A tag class representing the fabs() function.
Definition: forwards.h:158
viennacl::matrix_base< double > * matrix_double
Definition: forwards.h:412
A tag class representing the maximum of a vector.
Definition: forwards.h:209
viennacl::hyb_matrix< double > * hyb_matrix_double
Definition: forwards.h:467
A tag class representing the (off-)diagonal of a matrix.
Definition: forwards.h:185
viennacl::implicit_matrix_base< unsigned int > * implicit_matrix_uint
Definition: forwards.h:419
A tag class representing the atan() function.
Definition: forwards.h:146
viennacl::scalar< unsigned long > * scalar_ulong
Definition: forwards.h:374
A tag class representing the sinh() function.
Definition: forwards.h:176
viennacl::implicit_vector_base< unsigned int > * implicit_vector_uint
Definition: forwards.h:396
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< int > const &t)
Definition: forwards.h:599
static void assign_element(lhs_rhs_element &elem, viennacl::compressed_matrix< float > const &m)
Definition: forwards.h:606
statement_node_subtype
Encodes the type of a node in the statement tree.
Definition: forwards.h:266
std::vector< value_type > container_type
Definition: forwards.h:509
viennacl::matrix_base< long > * matrix_long
Definition: forwards.h:409
viennacl::matrix_base< unsigned short > * matrix_ushort
Definition: forwards.h:406
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::ell_matrix< T > const &t)
Definition: forwards.h:719
viennacl::implicit_matrix_base< unsigned short > * implicit_matrix_ushort
Definition: forwards.h:417
viennacl::compressed_matrix< float > * compressed_matrix_float
Definition: forwards.h:433
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< int > const &t)
Definition: forwards.h:552
A tag class representing the fmax() function.
Definition: forwards.h:164
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< float > const &t)
Definition: forwards.h:603
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< double > const &t)
Definition: forwards.h:557
A tag class representing the exp() function.
Definition: forwards.h:156
A tag class representing greater-than-or-equal-to.
Definition: forwards.h:110
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned long > const &t)
Definition: forwards.h:578
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned short > const &t)
Definition: forwards.h:598
static void assign_element(lhs_rhs_element &elem, viennacl::coordinate_matrix< float > const &m)
Definition: forwards.h:609
viennacl::implicit_matrix_base< unsigned char > * implicit_matrix_uchar
Definition: forwards.h:415
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:659
statement_node_numeric_type numeric_type
Definition: forwards.h:343
viennacl::vector_base< unsigned long > * vector_ulong
Definition: forwards.h:386
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< float > const &t)
Definition: forwards.h:592
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< double > const &t)
Definition: forwards.h:580
A tag class representing inequality.
Definition: forwards.h:104
viennacl::vector_base< float > * vector_float
Definition: forwards.h:387
A tag class representing less-than-or-equal-to.
Definition: forwards.h:112
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::hyb_matrix< T > const &t)
Definition: forwards.h:731
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned int > const &t)
Definition: forwards.h:565
A tag class representing addition.
Definition: forwards.h:87
viennacl::matrix_base< float > * matrix_float
Definition: forwards.h:411
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< float > const &t)
Definition: forwards.h:579
viennacl::implicit_vector_base< char > * implicit_vector_char
Definition: forwards.h:391
A tag class representing the sqrt() function.
Definition: forwards.h:178
viennacl::implicit_vector_base< unsigned long > * implicit_vector_ulong
Definition: forwards.h:398
A tag class representing matrix-matrix products.
Definition: forwards.h:95
static void assign_element(lhs_rhs_element &elem, viennacl::ell_matrix< double > const &m)
Definition: forwards.h:613
std::size_t vcl_size_t
Definition: forwards.h:74
viennacl::vector_base< double > * vector_double
Definition: forwards.h:388
viennacl::compressed_matrix< double > * compressed_matrix_double
Definition: forwards.h:434
viennacl::ell_matrix< double > * ell_matrix_double
Definition: forwards.h:456
viennacl::matrix_base< unsigned long > * matrix_ulong
Definition: forwards.h:410
viennacl::hyb_matrix< float > * hyb_matrix_float
Definition: forwards.h:466
viennacl::scalar< double > * scalar_double
Definition: forwards.h:376
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned int > const &t)
Definition: forwards.h:600
viennacl::scalar< unsigned short > * scalar_ushort
Definition: forwards.h:370
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
A tag class representing the minimum of a vector.
Definition: forwards.h:212
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned char > const &t)
Definition: forwards.h:549
operation_node_type
Enumeration for identifying the possible operations.
Definition: forwards.h:68
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< double > const &t)
Definition: forwards.h:593
viennacl::vector_base< char > * vector_char
Definition: forwards.h:379
viennacl::implicit_vector_base< short > * implicit_vector_short
Definition: forwards.h:393
statement(container_type const &custom_array)
Definition: forwards.h:511
A tag class representing the sin() function.
Definition: forwards.h:174
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned long > const &t)
Definition: forwards.h:555
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< long > const &t)
Definition: forwards.h:554
Helper metafunction for obtaining the runtime type ID for a numerical type.
Definition: forwards.h:312
viennacl::scalar< unsigned char > * scalar_uchar
Definition: forwards.h:368
A tag class representing the fmin() function.
Definition: forwards.h:166
A tag class representing inplace subtraction.
Definition: forwards.h:84
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< short > const &t)
Definition: forwards.h:573
static void assign_element(lhs_rhs_element &elem, int const &t)
Definition: forwards.h:541
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::vector_base< T > const &t)
Definition: forwards.h:647
static void assign_element(lhs_rhs_element &elem, viennacl::coordinate_matrix< double > const &m)
Definition: forwards.h:610
A tag class representing the 1-norm of a vector.
Definition: forwards.h:200
static void assign_element(lhs_rhs_element &elem, long const &t)
Definition: forwards.h:543
A tag class representing matrix-vector products and element-wise multiplications. ...
Definition: forwards.h:93
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< int > const &t)
Definition: forwards.h:564
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< unsigned short > const &t)
Definition: forwards.h:574
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< unsigned short > const &t)
Definition: forwards.h:551
viennacl::vector_base< unsigned char > * vector_uchar
Definition: forwards.h:380
scheduler::lhs_rhs_element & lhs_rhs_element(scheduler::statement const &st, vcl_size_t idx, leaf_t leaf)
Definition: utils.hpp:525
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned long > const &t)
Definition: forwards.h:591
A tag class representing the floor() function.
Definition: forwards.h:162
viennacl::implicit_matrix_base< float > * implicit_matrix_float
Definition: forwards.h:422
A tag class representing the asin() function.
Definition: forwards.h:140
viennacl::ell_matrix< float > * ell_matrix_float
Definition: forwards.h:455
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::compressed_matrix< T > const &t)
Definition: forwards.h:695
static void assign_element(lhs_rhs_element &elem, unsigned long const &t)
Definition: forwards.h:544
viennacl::scalar< int > * scalar_int
Definition: forwards.h:371
viennacl::implicit_vector_base< double > * implicit_vector_double
Definition: forwards.h:400
operation_node_type type
Definition: forwards.h:476
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned long > const &t)
Definition: forwards.h:567
static void assign_element(lhs_rhs_element &elem, viennacl::compressed_matrix< double > const &m)
Definition: forwards.h:607
static void assign_element(lhs_rhs_element &elem, unsigned int const &t)
Definition: forwards.h:542
A tag class for representing the argmax() function.
Definition: forwards.h:142
A tag class representing transposed matrices.
Definition: forwards.h:219
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< unsigned char > const &t)
Definition: forwards.h:596
viennacl::implicit_vector_base< unsigned short > * implicit_vector_ushort
Definition: forwards.h:394
A tag class representing element-wise binary operations (like multiplication) on vectors or matrices...
Definition: forwards.h:129
size_type root() const
Definition: forwards.h:532
The main class for representing a statement such as x = inner_prod(y,z); at runtime.
Definition: forwards.h:504
viennacl::scalar< char > * scalar_char
Definition: forwards.h:367
viennacl::implicit_matrix_base< short > * implicit_matrix_short
Definition: forwards.h:416
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:683
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< unsigned int > const &t)
Definition: forwards.h:589
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< int > const &t)
Definition: forwards.h:588
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::scalar< T > const &t)
Definition: forwards.h:634
A tag class representing sign flips (for scalars only. Vectors and matrices use the standard multipli...
Definition: forwards.h:222
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< long > const &t)
Definition: forwards.h:577
A tag class representing the acos() function.
Definition: forwards.h:138
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< float > const &t)
Definition: forwards.h:568
static void assign_element(lhs_rhs_element &elem, viennacl::matrix_base< char > const &t)
Definition: forwards.h:584
A tag class representing inner products of two vectors.
Definition: forwards.h:197
A tag class representing the extraction of a matrix row to a vector.
Definition: forwards.h:191
A tag class representing the power function.
Definition: forwards.h:99
A tag class representing the inf-norm of a vector.
Definition: forwards.h:206
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_matrix_base< double > const &t)
Definition: forwards.h:604
static void assign_element(lhs_rhs_element &elem, viennacl::implicit_vector_base< int > const &t)
Definition: forwards.h:575
A tag class representing the log10() function.
Definition: forwards.h:172
viennacl::matrix_base< int > * matrix_int
Definition: forwards.h:407
viennacl::implicit_matrix_base< long > * implicit_matrix_long
Definition: forwards.h:420
A tag class representing element-wise unary operations (like sin()) on vectors or matrices...
Definition: forwards.h:133
static vcl_size_t add_element(vcl_size_t next_free, lhs_rhs_element &elem, viennacl::coordinate_matrix< T > const &t)
Definition: forwards.h:707
A tag class representing the 2-norm of a vector.
Definition: forwards.h:203
viennacl::vector_base< long > * vector_long
Definition: forwards.h:385
A tag class for representing the argmin() function.
Definition: forwards.h:144
viennacl::coordinate_matrix< float > * coordinate_matrix_float
Definition: forwards.h:444
A tag class representing greater-than.
Definition: forwards.h:106
static void assign_element(lhs_rhs_element &elem, viennacl::hyb_matrix< double > const &m)
Definition: forwards.h:616
A tag class representing the cos() function.
Definition: forwards.h:152
viennacl::implicit_matrix_base< char > * implicit_matrix_char
Definition: forwards.h:414
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< char > const &t)
Definition: forwards.h:548
static void assign_element(lhs_rhs_element &elem, viennacl::scalar< short > const &t)
Definition: forwards.h:550
Main datastructure for an node in the statement tree.
Definition: forwards.h:480
Exception for the case the scheduler is unable to deal with the operation.
Definition: forwards.h:38
Simple enable-if variant that uses the SFINAE pattern.
static void assign_element(lhs_rhs_element &elem, short const &t)
Definition: forwards.h:539
statement_node_type_family
Groups the type of a node in the statement tree. Used for faster dispatching.
Definition: forwards.h:248
viennacl::matrix_base< unsigned int > * matrix_uint
Definition: forwards.h:408
operation_node_type_family
Optimization enum for grouping operations into unary or binary operations. Just for optimization of l...
Definition: forwards.h:53
viennacl::implicit_matrix_base< int > * implicit_matrix_int
Definition: forwards.h:418
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< long > const &t)
Definition: forwards.h:566
static void assign_element(lhs_rhs_element &elem, viennacl::vector_base< unsigned char > const &t)
Definition: forwards.h:561
A tag class representing element-wise casting operations on vectors and matrices. ...
Definition: forwards.h:125