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_NumericT(type) \ 
  114   VIENNACL_MAKE_ANY_VECTOR_TRUE(type<float>)\ 
  115   VIENNACL_MAKE_ANY_VECTOR_TRUE(type<double>) 
  118   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::vector_range)
 
  119   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::vector_slice)
 
  120   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::unit_vector)
 
  121   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::zero_vector)
 
  122   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::one_vector)
 
  123   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::scalar_vector)
 
  125 #undef VIENNACL_MAKE_FOR_ALL_NumericT 
  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_NumericT(TYPE) \ 
  135   VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<float>)\ 
  136   VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<double>) 
  138 #define VIENNACL_COMMA , 
  139 #define VIENNACL_MAKE_FOR_ALL_NumericT_LAYOUT(TYPE) \ 
  140   VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<float VIENNACL_COMMA viennacl::row_major>)\ 
  141   VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<double VIENNACL_COMMA viennacl::row_major>)\ 
  142   VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<float VIENNACL_COMMA viennacl::column_major>)\ 
  143   VIENNACL_MAKE_ANY_MATRIX_TRUE(TYPE<double VIENNACL_COMMA viennacl::column_major>) 
  148   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::identity_matrix)
 
  149   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::zero_matrix)
 
  150   VIENNACL_MAKE_FOR_ALL_NumericT(viennacl::scalar_matrix)
 
  152 #undef VIENNACL_MAKE_FOR_ALL_NumericT_LAYOUT 
  153 #undef VIENNACL_MAKE_FOR_ALL_NumericT 
  154 #undef VIENNACL_MAKE_ANY_MATRIX_TRUE 
  155 #undef VIENNACL_COMMA 
  168 template<
typename ScalarType>
 
  169 struct is_row_major<viennacl::matrix<ScalarType, viennacl::row_major> >
 
  171   enum { 
value = 
true };
 
  175 struct is_row_major< viennacl::
row_major >
 
  177   enum { 
value = 
true };
 
  181 struct is_row_major<viennacl::matrix_expression<T, T, viennacl::op_trans> >
 
  183   enum { 
value = is_row_major<T>::value };
 
  198 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  199 struct is_circulant_matrix<viennacl::circulant_matrix<ScalarType, AlignmentV> >
 
  201   enum { 
value = 
true };
 
  204 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  205 struct is_circulant_matrix<const viennacl::circulant_matrix<ScalarType, AlignmentV> >
 
  207   enum { 
value = 
true };
 
  221 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  222 struct is_hankel_matrix<viennacl::hankel_matrix<ScalarType, AlignmentV> >
 
  224   enum { 
value = 
true };
 
  227 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  228 struct is_hankel_matrix<const viennacl::hankel_matrix<ScalarType, AlignmentV> >
 
  230   enum { 
value = 
true };
 
  244 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  245 struct is_toeplitz_matrix<viennacl::toeplitz_matrix<ScalarType, AlignmentV> >
 
  247   enum { 
value = 
true };
 
  250 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  251 struct is_toeplitz_matrix<const viennacl::toeplitz_matrix<ScalarType, AlignmentV> >
 
  253   enum { 
value = 
true };
 
  267 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  268 struct is_vandermonde_matrix<viennacl::vandermonde_matrix<ScalarType, AlignmentV> >
 
  270   enum { 
value = 
true };
 
  273 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  274 struct is_vandermonde_matrix<const viennacl::vandermonde_matrix<ScalarType, AlignmentV> >
 
  276   enum { 
value = 
true };
 
  286 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  287 struct is_compressed_matrix<viennacl::compressed_matrix<ScalarType, AlignmentV> >
 
  289   enum { 
value = 
true };
 
  298 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  299 struct is_coordinate_matrix<viennacl::coordinate_matrix<ScalarType, AlignmentV> >
 
  301   enum { 
value = 
true };
 
  309 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  310 struct is_ell_matrix<viennacl::ell_matrix<ScalarType, AlignmentV> >
 
  312   enum { 
value = 
true };
 
  320 template<
typename ScalarType, 
typename IndexT>
 
  321 struct is_sliced_ell_matrix<viennacl::sliced_ell_matrix<ScalarType, IndexT> >
 
  323   enum { 
value = 
true };
 
  331 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  332 struct is_hyb_matrix<viennacl::hyb_matrix<ScalarType, AlignmentV> >
 
  334   enum { 
value = 
true };
 
  349 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  350 struct is_any_sparse_matrix<viennacl::compressed_matrix<ScalarType, AlignmentV> >
 
  352   enum { 
value = 
true };
 
  355 template<
typename ScalarType>
 
  356 struct is_any_sparse_matrix<viennacl::compressed_compressed_matrix<ScalarType> >
 
  358   enum { 
value = 
true };
 
  361 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  362 struct is_any_sparse_matrix<viennacl::coordinate_matrix<ScalarType, AlignmentV> >
 
  364   enum { 
value = 
true };
 
  367 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  368 struct is_any_sparse_matrix<viennacl::ell_matrix<ScalarType, AlignmentV> >
 
  370   enum { 
value = 
true };
 
  373 template<
typename ScalarType, 
typename IndexT>
 
  374 struct is_any_sparse_matrix<viennacl::sliced_ell_matrix<ScalarType, IndexT> >
 
  376   enum { 
value = 
true };
 
  379 template<
typename ScalarType, 
unsigned int AlignmentV>
 
  380 struct is_any_sparse_matrix<viennacl::hyb_matrix<ScalarType, AlignmentV> >
 
  382   enum { 
value = 
true };
 
  386 struct is_any_sparse_matrix<const T>
 
  388   enum { 
value = is_any_sparse_matrix<T>::value };
 
  407 struct is_addition<viennacl::op_add>
 
  409   enum { 
value = 
true };
 
  425 struct is_subtraction<viennacl::op_sub>
 
  427   enum { 
value = 
true };
 
  443 struct is_product<viennacl::op_prod>
 
  445   enum { 
value = 
true };
 
  449 struct is_product<viennacl::op_mult>
 
  451   enum { 
value = 
true };
 
  455 struct is_product<viennacl::op_element_binary<op_prod> >
 
  457   enum { 
value = 
true };
 
  473 struct is_division<viennacl::op_div>
 
  475   enum { 
value = 
true };
 
  479 struct is_division<viennacl::op_element_binary<op_div> >
 
  481   enum { 
value = 
true };
 
  494 template<> 
struct is_primitive_type<double>        { 
enum { 
value = 
true }; };
 
  495 template<> 
struct is_primitive_type<unsigned int>  { 
enum { 
value = 
true }; };
 
  496 template<> 
struct is_primitive_type<int>           { 
enum { 
value = 
true }; };
 
  497 template<> 
struct is_primitive_type<unsigned char> { 
enum { 
value = 
true }; };
 
  498 template<> 
struct is_primitive_type<char>          { 
enum { 
value = 
true }; };
 
  499 template<> 
struct is_primitive_type<unsigned long> { 
enum { 
value = 
true }; };
 
  500 template<> 
struct is_primitive_type<long>          { 
enum { 
value = 
true }; };
 
  501 template<> 
struct is_primitive_type<unsigned short>{ 
enum { 
value = 
true }; };
 
  502 template<> 
struct is_primitive_type<short>         { 
enum { 
value = 
true }; };
 
  505 #ifdef VIENNACL_WITH_OPENCL 
  509 struct is_cl_type{ 
enum { value = 
false }; };
 
  512 template<> 
struct is_cl_type<cl_float> { 
enum { value = 
true }; };
 
  513 template<> 
struct is_cl_type<cl_double>{ 
enum { value = 
true }; };
 
  514 template<> 
struct is_cl_type<cl_uint>  { 
enum { value = 
true }; };
 
  515 template<> 
struct is_cl_type<cl_int>   { 
enum { value = 
true }; };
 
  516 template<> 
struct is_cl_type<cl_uchar> { 
enum { value = 
true }; };
 
  517 template<> 
struct is_cl_type<cl_char>  { 
enum { value = 
true }; };
 
  518 template<> 
struct is_cl_type<cl_ulong> { 
enum { value = 
true }; };
 
  519 template<> 
struct is_cl_type<cl_long>  { 
enum { value = 
true }; };
 
  520 template<> 
struct is_cl_type<cl_ushort>{ 
enum { value = 
true }; };
 
  521 template<> 
struct is_cl_type<cl_short> { 
enum { value = 
true }; };
 
  525 template<
class T> 
struct is_floating_point { 
enum { value = 
false }; };
 
  526 template<> 
struct is_floating_point<float> { 
enum { value = 
true }; };
 
  527 template<> 
struct is_floating_point<double> { 
enum { value = 
true }; };
 
Helper class for checking whether a type is a primitive type. 
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) ...
Helper metafunction for checking whether the provided type is viennacl::op_div (for division) ...
Helper metafunction for checking whether the provided type is viennacl::op_add (for addition) ...
bool row_major(T const &)
Helper metafunction for checking whether the provided type is viennacl::op_prod (for products/multipl...