1 #ifndef VIENNACL_TOOLS_TOOLS_HPP_ 
    2 #define VIENNACL_TOOLS_TOOLS_HPP_ 
   41 template<
class NumericT, 
typename F, 
unsigned int AlignmentV>
 
   42 struct MATRIX_ITERATOR_INCREMENTER<viennacl::row_iteration, 
viennacl::matrix<NumericT, F, AlignmentV> >
 
   50 template<
class NumericT, 
typename F, 
unsigned int AlignmentV>
 
   51 struct MATRIX_ITERATOR_INCREMENTER<viennacl::col_iteration, 
viennacl::matrix<NumericT, F, AlignmentV> >
 
   65   typedef typename T::ERROR_SCALAR_MUST_HAVE_TEMPLATE_ARGUMENT_FLOAT_OR_DOUBLE  
ResultType;
 
   76 struct CHECK_SCALAR_TEMPLATE_ARGUMENT<double>
 
   91   std::ifstream f(filename.c_str());
 
   92   if (!f) 
return std::string();
 
   94   std::stringstream result;
 
   96   while (std::getline(f, tmp))
 
   97     result << tmp << std::endl;
 
  109 inline std::string 
str_replace(
const std::string & text, std::string to_search, std::string to_replace)
 
  111   std::string::size_type pos = 0;
 
  113   std::string::size_type found;
 
  114   while ( (found = text.find(to_search, pos)) != std::string::npos )
 
  116     result.append(text.substr(pos,found-pos));
 
  117     result.append(to_replace);
 
  118     pos = found + to_search.length();
 
  120   if (pos < text.length())
 
  121     result.append(text.substr(pos));
 
  132 template<
class INT_TYPE>
 
  135   if (to_reach % base == 0) 
return to_reach;
 
  136   return ((to_reach / base) + 1) * base;
 
  147 template<
class INT_TYPE>
 
  150   if (to_reach % base == 0) 
return to_reach;
 
  151   return (to_reach / base) * base;
 
  160 int inline find_and_replace(std::string & source, std::string 
const & find, std::string 
const & replace)
 
  165   for (
vcl_size_t pos=0; (pos=source.find(find, pos))!=std::string::npos; pos+=rLen)
 
  168     source.replace(pos, fLen, replace);
 
  174 template<
class InputIterator, 
class UnaryPredicate>
 
  175 bool any_of (InputIterator first, InputIterator last, UnaryPredicate pred)
 
  179     if (pred(*first)) 
return true;
 
  193   std::stringstream ss;
 
  194   ss << 
"#pragma OPENCL EXTENSION " << fp_extension << 
" : enable\n\n";
 
  196   std::string result = ss.str();
 
  197   result.append(
str_replace(source, 
"float", 
"double"));
 
  235   typedef float       ResultType;
 
  239 struct CPU_SCALAR_TYPE_DEDUCER< double >
 
  241   typedef double       ResultType;
 
  245 struct CPU_SCALAR_TYPE_DEDUCER< viennacl::scalar<T> >
 
  247   typedef T       ResultType;
 
  250 template<
typename T, 
unsigned int A>
 
  251 struct CPU_SCALAR_TYPE_DEDUCER< viennacl::vector<T, A> >
 
  253   typedef T       ResultType;
 
  256 template<
typename T, 
typename F, 
unsigned int A>
 
  257 struct CPU_SCALAR_TYPE_DEDUCER< viennacl::matrix<T, F, A> >
 
  259   typedef T       ResultType;
 
  263 template<
typename T, 
typename F, 
unsigned int A>
 
  264 struct CPU_SCALAR_TYPE_DEDUCER< viennacl::matrix_expression<const matrix<T, F, A>, const matrix<T, F, A>, op_trans> >
 
  266   typedef T       ResultType;
 
  274 template<
typename HostScalarType>
 
  277 template<
typename HostScalarType>
 
  285 template<
typename HostScalarType>
 
  288 template<
typename HostScalarType>
 
  291 template<
typename HostScalarType>
 
  294 template<
typename HostScalarType>
 
  297 template<
typename HostScalarType>
 
  300 template<
typename HostScalarType>
 
  306   std::stringstream ss;
 
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
Adapter classes for sparse matrices made of the STL type std::vector > 
This file provides the forward declarations for the main types used within ViennaCL. 
A proxy for scalar expressions (e.g. from inner vector products) 
vector_expression< const matrix_base< NumericT, F >, const unsigned int, op_row > row(const matrix_base< NumericT, F > &A, unsigned int i)
A tag class representing sign flips (for scalars only. Vectors and matrices use the standard multipli...