ViennaCL - The Vienna Computing Library  1.2.0
predicate.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_META_PREDICATE_HPP_
2 #define VIENNACL_META_PREDICATE_HPP_
3 
4 /* =========================================================================
5  Copyright (c) 2010-2011, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8 
9  -----------------
10  ViennaCL - The Vienna Computing Library
11  -----------------
12 
13  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
14 
15  (A list of authors and contributors can be found in the PDF manual)
16 
17  License: MIT (X11), see file LICENSE in the base directory
18 ============================================================================= */
19 
24 #include <string>
25 #include <fstream>
26 #include <sstream>
27 #include "viennacl/forwards.h"
28 
29 namespace viennacl
30 {
31  //
32  // is_cpu_scalar: checks for float or double
33  //
34  template <typename T>
36  {
37  enum { value = false };
38  };
39 
40  template <>
41  struct is_cpu_scalar<float>
42  {
43  enum { value = true };
44  };
45 
46  template <>
47  struct is_cpu_scalar<double>
48  {
49  enum { value = true };
50  };
51 
52  //
53  // is_scalar: checks for viennacl::scalar
54  //
55  template <typename T>
56  struct is_scalar
57  {
58  enum { value = false };
59  };
60 
61  template <typename T>
62  struct is_scalar<viennacl::scalar<T> >
63  {
64  enum { value = true };
65  };
66 
67  //
68  // is_vector
69  //
70  template <typename T>
71  struct is_vector
72  {
73  enum { value = false };
74  };
75 
76  template <typename ScalarType, unsigned int ALIGNMENT>
77  struct is_vector<viennacl::vector<ScalarType, ALIGNMENT> >
78  {
79  enum { value = true };
80  };
81 
82  template <typename T>
83  struct is_vector<viennacl::vector_range<T> >
84  {
85  enum { value = true };
86  };
87 
88 
89 
90  //
91  // is_matrix
92  //
93  template <typename T>
94  struct is_matrix
95  {
96  enum { value = false };
97  };
98 
99  template <typename ScalarType, typename F, unsigned int ALIGNMENT>
100  struct is_matrix<viennacl::matrix<ScalarType, F, ALIGNMENT> >
101  {
102  enum { value = true };
103  };
104 
105  template <typename T>
106  struct is_matrix<viennacl::matrix_range<T> >
107  {
108  enum { value = true };
109  };
110 
111 
112 } //namespace viennacl
113 
114 
115 #endif