1 #ifndef VIENNACL_META_PREDICATE_HPP_
2 #define VIENNACL_META_PREDICATE_HPP_
30 #ifdef VIENNACL_WITH_OPENCL
32 #include <OpenCL/cl.h>
51 template <>
struct is_cpu_scalar<char> {
enum {
value =
true }; };
52 template <>
struct is_cpu_scalar<unsigned char> {
enum {
value =
true }; };
53 template <>
struct is_cpu_scalar<short> {
enum {
value =
true }; };
54 template <>
struct is_cpu_scalar<unsigned short> {
enum {
value =
true }; };
55 template <>
struct is_cpu_scalar<int> {
enum {
value =
true }; };
56 template <>
struct is_cpu_scalar<unsigned int> {
enum {
value =
true }; };
57 template <>
struct is_cpu_scalar<long> {
enum {
value =
true }; };
58 template <>
struct is_cpu_scalar<unsigned long> {
enum {
value =
true }; };
59 template <>
struct is_cpu_scalar<float> {
enum {
value =
true }; };
60 template <>
struct is_cpu_scalar<double> {
enum {
value =
true }; };
75 struct is_scalar<
viennacl::scalar<T> >
77 enum {
value =
true };
92 struct is_flip_sign_scalar<
viennacl::scalar_expression< const scalar<T>,
96 enum {
value =
true };
112 #define VIENNACL_MAKE_ANY_VECTOR_TRUE(type) template<> struct is_any_vector< type > { enum { value = 1 }; };
113 #define VIENNACL_MAKE_FOR_ALL_SCALARTYPE(type) \
114 VIENNACL_MAKE_ANY_VECTOR_TRUE(type<float>)\
115 VIENNACL_MAKE_ANY_VECTOR_TRUE(type<double>)
118 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::vector_range)
119 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::vector_slice)
120 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::unit_vector)
121 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::zero_vector)
122 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::one_vector)
123 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::scalar_vector)
125 #undef VIENNACL_MAKE_FOR_ALL_SCALARTYPE
126 #undef VIENNACL_MAKE_ANY_VECTOR_TRUE
131 #define VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE)\
132 template<> struct is_any_dense_matrix< TYPE > { enum { value = 1 }; };
134 #define VIENNACL_MAKE_FOR_ALL_SCALARTYPE(TYPE) \
135 VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<float>)\
136 VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<double>)
139 #define VIENNACL_MAKE_FOR_ALL_SCALARTYPE_LAYOUT(TYPE) \
140 VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<float COMMA viennacl::row_major>)\
141 VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<double COMMA viennacl::row_major>)\
142 VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<float COMMA viennacl::column_major>)\
143 VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<double COMMA viennacl::column_major>)
148 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::identity_matrix)
149 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::zero_matrix)
150 VIENNACL_MAKE_FOR_ALL_SCALARTYPE(
viennacl::scalar_matrix)
152 #undef VIENNACL_MAKE_FOR_ALL_SCALARTYPE_LAYOUT
153 #undef VIENNACL_MAKE_FOR_ALL_SCALARTYPE
154 #undef VIENNACL_MAKE_ANY_MATRIX_TRUE
167 template <
typename ScalarType>
170 enum {
value =
true };
176 enum {
value =
true };
179 template <
typename T>
182 enum {
value = is_row_major<T>::value };
197 template <
typename ScalarType,
unsigned int ALIGNMENT>
198 struct is_circulant_matrix<
viennacl::circulant_matrix<ScalarType, ALIGNMENT> >
200 enum {
value =
true };
203 template <
typename ScalarType,
unsigned int ALIGNMENT>
204 struct is_circulant_matrix<const
viennacl::circulant_matrix<ScalarType, ALIGNMENT> >
206 enum {
value =
true };
220 template <
typename ScalarType,
unsigned int ALIGNMENT>
221 struct is_hankel_matrix<
viennacl::hankel_matrix<ScalarType, ALIGNMENT> >
223 enum {
value =
true };
226 template <
typename ScalarType,
unsigned int ALIGNMENT>
227 struct is_hankel_matrix<const
viennacl::hankel_matrix<ScalarType, ALIGNMENT> >
229 enum {
value =
true };
243 template <
typename ScalarType,
unsigned int ALIGNMENT>
244 struct is_toeplitz_matrix<
viennacl::toeplitz_matrix<ScalarType, ALIGNMENT> >
246 enum {
value =
true };
249 template <
typename ScalarType,
unsigned int ALIGNMENT>
250 struct is_toeplitz_matrix<const
viennacl::toeplitz_matrix<ScalarType, ALIGNMENT> >
252 enum {
value =
true };
266 template <
typename ScalarType,
unsigned int ALIGNMENT>
267 struct is_vandermonde_matrix<
viennacl::vandermonde_matrix<ScalarType, ALIGNMENT> >
269 enum {
value =
true };
272 template <
typename ScalarType,
unsigned int ALIGNMENT>
273 struct is_vandermonde_matrix<const
viennacl::vandermonde_matrix<ScalarType, ALIGNMENT> >
275 enum {
value =
true };
285 template <
typename ScalarType,
unsigned int ALIGNMENT>
286 struct is_compressed_matrix<
viennacl::compressed_matrix<ScalarType, ALIGNMENT> >
288 enum {
value =
true };
297 template <
typename ScalarType,
unsigned int ALIGNMENT>
298 struct is_coordinate_matrix<
viennacl::coordinate_matrix<ScalarType, ALIGNMENT> >
300 enum {
value =
true };
308 template <
typename ScalarType,
unsigned int ALIGNMENT>
309 struct is_ell_matrix<
viennacl::ell_matrix<ScalarType, ALIGNMENT> >
311 enum {
value =
true };
319 template <
typename ScalarType,
unsigned int ALIGNMENT>
320 struct is_hyb_matrix<
viennacl::hyb_matrix<ScalarType, ALIGNMENT> >
322 enum {
value =
true };
337 template <
typename ScalarType,
unsigned int ALIGNMENT>
338 struct is_any_sparse_matrix<
viennacl::compressed_matrix<ScalarType, ALIGNMENT> >
340 enum {
value =
true };
343 template <
typename ScalarType>
344 struct is_any_sparse_matrix<
viennacl::compressed_compressed_matrix<ScalarType> >
346 enum {
value =
true };
349 template <
typename ScalarType,
unsigned int ALIGNMENT>
350 struct is_any_sparse_matrix<
viennacl::coordinate_matrix<ScalarType, ALIGNMENT> >
352 enum {
value =
true };
355 template <
typename ScalarType,
unsigned int ALIGNMENT>
356 struct is_any_sparse_matrix<
viennacl::ell_matrix<ScalarType, ALIGNMENT> >
358 enum {
value =
true };
361 template <
typename ScalarType,
unsigned int ALIGNMENT>
362 struct is_any_sparse_matrix<
viennacl::hyb_matrix<ScalarType, ALIGNMENT> >
364 enum {
value =
true };
367 template <
typename T>
368 struct is_any_sparse_matrix<const T>
370 enum {
value = is_any_sparse_matrix<T>::value };
381 template <
typename T>
389 struct is_addition<
viennacl::op_add>
391 enum {
value =
true };
399 template <
typename T>
407 struct is_subtraction<
viennacl::op_sub>
409 enum {
value =
true };
417 template <
typename T>
425 struct is_product<
viennacl::op_prod>
427 enum {
value =
true };
431 struct is_product<
viennacl::op_mult>
433 enum {
value =
true };
437 struct is_product<
viennacl::op_element_binary<op_prod> >
439 enum {
value =
true };
447 template <
typename T>
455 struct is_division<
viennacl::op_div>
457 enum {
value =
true };
461 struct is_division<
viennacl::op_element_binary<op_div> >
463 enum {
value =
true };
476 template<>
struct is_primitive_type<double> {
enum {
value =
true }; };
477 template<>
struct is_primitive_type<unsigned int> {
enum {
value =
true }; };
478 template<>
struct is_primitive_type<int> {
enum {
value =
true }; };
479 template<>
struct is_primitive_type<unsigned char> {
enum {
value =
true }; };
480 template<>
struct is_primitive_type<char> {
enum {
value =
true }; };
481 template<>
struct is_primitive_type<unsigned long> {
enum {
value =
true }; };
482 template<>
struct is_primitive_type<long> {
enum {
value =
true }; };
483 template<>
struct is_primitive_type<unsigned short>{
enum {
value =
true }; };
484 template<>
struct is_primitive_type<short> {
enum {
value =
true }; };
487 #ifdef VIENNACL_WITH_OPENCL
491 struct is_cl_type{
enum { value =
false }; };
494 template<>
struct is_cl_type<cl_float> {
enum { value =
true }; };
495 template<>
struct is_cl_type<cl_double>{
enum { value =
true }; };
496 template<>
struct is_cl_type<cl_uint> {
enum { value =
true }; };
497 template<>
struct is_cl_type<cl_int> {
enum { value =
true }; };
498 template<>
struct is_cl_type<cl_uchar> {
enum { value =
true }; };
499 template<>
struct is_cl_type<cl_char> {
enum { value =
true }; };
500 template<>
struct is_cl_type<cl_ulong> {
enum { value =
true }; };
501 template<>
struct is_cl_type<cl_long> {
enum { value =
true }; };
502 template<>
struct is_cl_type<cl_ushort>{
enum { value =
true }; };
503 template<>
struct is_cl_type<cl_short> {
enum { value =
true }; };
bool is_row_major(viennacl::row_major_tag)
Definition: common.hpp:73
Definition: forwards.h:415
Definition: forwards.h:429
Helper class for checking whether a type is a primitive type.
Definition: predicate.hpp:472
A dense matrix class.
Definition: forwards.h:293
This file provides the forward declarations for the main types used within ViennaCL.
Helper metafunction for checking whether the provided type is viennacl::op_sub (for subtraction) ...
Definition: predicate.hpp:400
Definition: forwards.h:436
Definition: forwards.h:401
Definition: forwards.h:365
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
Definition: predicate.hpp:472
Definition: predicate.hpp:450
Definition: forwards.h:444
Definition: forwards.h:379
Definition: forwards.h:458
Definition: forwards.h:465
Definition: predicate.hpp:384
Helper metafunction for checking whether the provided type is viennacl::op_div (for division) ...
Definition: predicate.hpp:448
Definition: forwards.h:372
Definition: forwards.h:408
Definition: forwards.h:451
A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::v...
Definition: forwards.h:208
Helper metafunction for checking whether the provided type is viennacl::op_add (for addition) ...
Definition: predicate.hpp:382
Definition: predicate.hpp:402
Helper metafunction for checking whether the provided type is viennacl::op_prod (for products/multipl...
Definition: predicate.hpp:418
Definition: forwards.h:422
Definition: predicate.hpp:420