45 template<
typename ScalarType>
 
   50       return (s1 - s2) / 
std::max(std::fabs(s1), std::fabs(s2));
 
   56 template<
typename ScalarType>
 
   61       return (s1 - s2) / 
std::max(std::fabs(s1), std::fabs(s2));
 
   67 template<
typename ScalarType>
 
   72       return (s1 - s2) / 
std::max(std::fabs(s1), std::fabs(s2));
 
   78 template<
typename ScalarType, 
typename ViennaCLVectorType>
 
   79 ScalarType diff(std::vector<ScalarType> 
const & 
v1, ViennaCLVectorType 
const & vcl_vec)
 
   81    std::vector<ScalarType> v2_cpu(vcl_vec.size());
 
   85    for (
unsigned int i=0;i<v1.size(); ++i)
 
   87       if ( 
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) ) > 0 )
 
   88          v2_cpu[i] = std::fabs(v2_cpu[i] - v1[i]) / 
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) );
 
   94    for (std::size_t i=0; i<v2_cpu.size(); ++i)
 
   95      norm_inf = std::max<ScalarType>(norm_inf, std::fabs(v2_cpu[i]));
 
  102 template<
typename T1, 
typename T2>
 
  103 int check(T1 
const & t1, T2 
const & t2, 
double epsilon)
 
  105   int retval = EXIT_SUCCESS;
 
  107   double temp = std::fabs(
diff(t1, t2));
 
  110     std::cout << 
"# Error! Relative difference: " << temp << std::endl;
 
  111     retval = EXIT_FAILURE;
 
  120 template< 
typename NumericT, 
typename Epsilon,
 
  121           typename STLVectorType1,      
typename STLVectorType2,      
typename STLVectorType3,      
typename STLVectorType4,
 
  122           typename ViennaCLVectorType1, 
typename ViennaCLVectorType2, 
typename ViennaCLVectorType3, 
typename ViennaCLVectorType4 >
 
  123 int test(Epsilon 
const& epsilon,
 
  124          STLVectorType1      & std_v1, STLVectorType2      & std_v2, STLVectorType3      & std_v3, STLVectorType4      & std_v4,
 
  125          ViennaCLVectorType1 & vcl_v1, ViennaCLVectorType2 & vcl_v2, ViennaCLVectorType3 & vcl_v3, ViennaCLVectorType4 & vcl_v4)
 
  127   int retval = EXIT_SUCCESS;
 
  131   for (std::size_t i=0; i<std_v1.size(); ++i)
 
  133     std_v1[i] = 
NumericT(1.0) + randomNumber();
 
  134     std_v2[i] = 
NumericT(1.0) + randomNumber();
 
  135     std_v3[i] = 
NumericT(1.0) + randomNumber();
 
  136     std_v4[i] = 
NumericT(1.0) + randomNumber();
 
  144   std::cout << 
"Checking for successful copy..." << std::endl;
 
  145   if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
 
  147   if (
check(std_v2, vcl_v2, epsilon) != EXIT_SUCCESS)
 
  149   if (
check(std_v3, vcl_v3, epsilon) != EXIT_SUCCESS)
 
  151   if (
check(std_v4, vcl_v4, epsilon) != EXIT_SUCCESS)
 
  154   std::vector<NumericT> ref_result(40, 0.0);
 
  157   std::cout << 
"Testing inner_prod with two vectors..." << std::endl;
 
  158   ref_result[2] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[2] += std_v1[i] * std_v1[i];
 
  159   ref_result[5] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[5] += std_v1[i] * std_v2[i];
 
  161   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  163     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  164     std::cout << result << std::endl;
 
  168   ref_result[3] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[3] += std_v1[i] * std_v3[i];
 
  169   ref_result[7] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[7] += std_v1[i] * std_v4[i];
 
  171   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  173     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  174     std::cout << result << std::endl;
 
  179   std::cout << 
"Testing inner_prod with three vectors..." << std::endl;
 
  180   ref_result[1] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[1] += std_v1[i] * std_v1[i];
 
  181   ref_result[3] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[3] += std_v1[i] * std_v2[i];
 
  182   ref_result[5] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[5] += std_v1[i] * std_v3[i];
 
  184   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  186     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  187     std::cout << result << std::endl;
 
  191   ref_result[2]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[2]  += std_v1[i] * std_v3[i];
 
  192   ref_result[6]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[6]  += std_v1[i] * std_v2[i];
 
  193   ref_result[10] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[10] += std_v1[i] * std_v4[i];
 
  195   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  197     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  198     std::cout << result << std::endl;
 
  202   std::cout << 
"Testing inner_prod with four vectors..." << std::endl;
 
  203   ref_result[4] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[4] += std_v1[i] * std_v1[i];
 
  204   ref_result[5] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[5] += std_v1[i] * std_v2[i];
 
  205   ref_result[6] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[6] += std_v1[i] * std_v3[i];
 
  206   ref_result[7] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[7] += std_v1[i] * std_v4[i];
 
  208   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  210     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  211     std::cout << result << std::endl;
 
  215   ref_result[3]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[3]  += std_v1[i] * std_v3[i];
 
  216   ref_result[6]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[6]  += std_v1[i] * std_v2[i];
 
  217   ref_result[9]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[9]  += std_v1[i] * std_v4[i];
 
  218   ref_result[12] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[12] += std_v1[i] * std_v1[i];
 
  220   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  222     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  223     std::cout << result << std::endl;
 
  227   std::cout << 
"Testing inner_prod with five vectors..." << std::endl;
 
  228   ref_result[1] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[1] += std_v1[i] * std_v1[i];
 
  229   ref_result[3] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[3] += std_v1[i] * std_v2[i];
 
  230   ref_result[5] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[5] += std_v1[i] * std_v3[i];
 
  231   ref_result[7] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[7] += std_v1[i] * std_v4[i];
 
  232   ref_result[9] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[9] += std_v1[i] * std_v2[i];
 
  234   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  236     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  237     std::cout << result << std::endl;
 
  241   ref_result[2]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[2]  += std_v1[i] * std_v3[i];
 
  242   ref_result[4]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[4]  += std_v1[i] * std_v2[i];
 
  243   ref_result[6]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[6]  += std_v1[i] * std_v4[i];
 
  244   ref_result[8]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[8]  += std_v1[i] * std_v1[i];
 
  245   ref_result[10] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[10] += std_v1[i] * std_v2[i];
 
  247   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  249     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  250     std::cout << result << std::endl;
 
  255   std::cout << 
"Testing inner_prod with eight vectors..." << std::endl;
 
  256   ref_result[1]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[1]  += std_v1[i] * std_v1[i];
 
  257   ref_result[5]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[5]  += std_v1[i] * std_v2[i];
 
  258   ref_result[9]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[9]  += std_v1[i] * std_v3[i];
 
  259   ref_result[13] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[13] += std_v1[i] * std_v4[i];
 
  260   ref_result[17] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[17] += std_v1[i] * std_v3[i];
 
  261   ref_result[21] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[21] += std_v1[i] * std_v2[i];
 
  262   ref_result[25] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[25] += std_v1[i] * std_v1[i];
 
  263   ref_result[29] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[29] += std_v1[i] * std_v2[i];
 
  264   std::vector<viennacl::vector_base<NumericT> 
const *> vecs1(8);
 
  275   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  277     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  278     std::cout << result << std::endl;
 
  282   ref_result[3]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[3]  += std_v1[i] * std_v2[i];
 
  283   ref_result[5]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[5]  += std_v1[i] * std_v4[i];
 
  284   ref_result[7]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[7]  += std_v1[i] * std_v1[i];
 
  285   ref_result[9]  = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[9]  += std_v1[i] * std_v2[i];
 
  286   ref_result[11] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[11] += std_v1[i] * std_v2[i];
 
  287   ref_result[13] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[13] += std_v1[i] * std_v1[i];
 
  288   ref_result[15] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[15] += std_v1[i] * std_v4[i];
 
  289   ref_result[17] = 0; 
for (std::size_t i=0; i<std_v1.size(); ++i) ref_result[17] += std_v1[i] * std_v2[i];
 
  290   std::vector<viennacl::vector_base<NumericT> 
const *> vecs2(8);
 
  301   if (
check(ref_result, result, epsilon) != EXIT_SUCCESS)
 
  303     std::copy(ref_result.begin(), ref_result.end(), std::ostream_iterator<NumericT>(std::cout, 
" ")); std::cout << std::endl;
 
  304     std::cout << result << std::endl;
 
  314 template< 
typename NumericT, 
typename Epsilon >
 
  315 int test(Epsilon 
const& epsilon)
 
  319   int retval = EXIT_SUCCESS;
 
  320   std::size_t 
size = 8 * 1337;
 
  322   std::cout << 
"Running tests for vector of size " << size << std::endl;
 
  327   std::vector<NumericT> std_full_vec1(size);
 
  328   std::vector<NumericT> std_full_vec2(std_full_vec1.size());
 
  330   for (std::size_t i=0; i<std_full_vec1.size(); ++i)
 
  332     std_full_vec1[i] = 
NumericT(1.0) + randomNumber();
 
  333     std_full_vec2[i] = 
NumericT(1.0) + randomNumber();
 
  336   std::vector<NumericT> std_slice_vec1(std_full_vec1.size() / 8); 
for (std::size_t i=0; i<std_slice_vec1.size(); ++i) std_slice_vec1[i] = std_full_vec1[    std_full_vec1.size() / 8 + i * 3];
 
  337   std::vector<NumericT> std_slice_vec2(std_full_vec2.size() / 8); 
for (std::size_t i=0; i<std_slice_vec2.size(); ++i) std_slice_vec2[i] = std_full_vec2[2 * std_full_vec2.size() / 8 + i * 1];
 
  338   std::vector<NumericT> std_slice_vec3(std_full_vec1.size() / 8); 
for (std::size_t i=0; i<std_slice_vec3.size(); ++i) std_slice_vec3[i] = std_full_vec1[4 * std_full_vec1.size() / 8 + i * 2];
 
  339   std::vector<NumericT> std_slice_vec4(std_full_vec2.size() / 8); 
for (std::size_t i=0; i<std_slice_vec4.size(); ++i) std_slice_vec4[i] = std_full_vec2[3 * std_full_vec2.size() / 8 + i * 4];
 
  348   viennacl::copy     (std_full_vec2.begin(), std_full_vec2.end(), vcl_full_vec2.begin());
 
  350   viennacl::slice vcl_s1(    vcl_full_vec1.size() / 8, 3, vcl_full_vec1.size() / 8);
 
  351   viennacl::slice vcl_s2(2 * vcl_full_vec2.size() / 8, 1, vcl_full_vec2.size() / 8);
 
  352   viennacl::slice vcl_s3(4 * vcl_full_vec1.size() / 8, 2, vcl_full_vec1.size() / 8);
 
  353   viennacl::slice vcl_s4(3 * vcl_full_vec2.size() / 8, 4, vcl_full_vec2.size() / 8);
 
  364   std::vector<NumericT> std_short_vec1(std_slice_vec1);
 
  365   std::vector<NumericT> std_short_vec2(std_slice_vec2);
 
  366   std::vector<NumericT> std_short_vec3(std_slice_vec2.size()); 
for (std::size_t i=0; i<std_short_vec3.size(); ++i) std_short_vec3[i] = std_slice_vec2[i] + std_slice_vec1[i];
 
  367   std::vector<NumericT> std_short_vec4(std_slice_vec2.size()); 
for (std::size_t i=0; i<std_short_vec4.size(); ++i) std_short_vec4[i] = std_slice_vec1[i] + std_slice_vec2[i];
 
  369   std::cout << 
"Testing creation of vectors from slice..." << std::endl;
 
  370   if (
check(std_short_vec1, vcl_short_vec1, epsilon) != EXIT_SUCCESS)
 
  372   if (
check(std_short_vec2, vcl_short_vec2, epsilon) != EXIT_SUCCESS)
 
  374   if (
check(std_short_vec3, vcl_short_vec3, epsilon) != EXIT_SUCCESS)
 
  376   if (
check(std_short_vec4, vcl_short_vec4, epsilon) != EXIT_SUCCESS)
 
  384   std::cout << 
" ** [vector|vector|vector|vector] **" << std::endl;
 
  385   retval = test<NumericT>(epsilon,
 
  386                           std_short_vec1, std_short_vec2, std_short_vec2, std_short_vec2,
 
  387                           vcl_short_vec1, vcl_short_vec2, vcl_short_vec3, vcl_short_vec4);
 
  388   if (retval != EXIT_SUCCESS)
 
  391   std::cout << 
" ** [vector|vector|vector|slice] **" << std::endl;
 
  392   retval = test<NumericT>(epsilon,
 
  393                           std_short_vec1, std_short_vec2, std_short_vec2, std_slice_vec2,
 
  394                           vcl_short_vec1, vcl_short_vec2, vcl_short_vec3, vcl_slice_vec4);
 
  395   if (retval != EXIT_SUCCESS)
 
  398   std::cout << 
" ** [vector|vector|slice|vector] **" << std::endl;
 
  399   retval = test<NumericT>(epsilon,
 
  400                           std_short_vec1, std_short_vec2, std_slice_vec2, std_short_vec2,
 
  401                           vcl_short_vec1, vcl_short_vec2, vcl_slice_vec3, vcl_short_vec4);
 
  402   if (retval != EXIT_SUCCESS)
 
  405   std::cout << 
" ** [vector|vector|slice|slice] **" << std::endl;
 
  406   retval = test<NumericT>(epsilon,
 
  407                           std_short_vec1, std_short_vec2, std_slice_vec2, std_slice_vec2,
 
  408                           vcl_short_vec1, vcl_short_vec2, vcl_slice_vec3, vcl_slice_vec4);
 
  409   if (retval != EXIT_SUCCESS)
 
  412   std::cout << 
" ** [vector|slice|vector|vector] **" << std::endl;
 
  413   retval = test<NumericT>(epsilon,
 
  414                           std_short_vec1, std_slice_vec2, std_short_vec2, std_short_vec2,
 
  415                           vcl_short_vec1, vcl_slice_vec2, vcl_short_vec3, vcl_short_vec4);
 
  416   if (retval != EXIT_SUCCESS)
 
  419   std::cout << 
" ** [vector|slice|vector|slice] **" << std::endl;
 
  420   retval = test<NumericT>(epsilon,
 
  421                           std_short_vec1, std_slice_vec2, std_short_vec2, std_slice_vec2,
 
  422                           vcl_short_vec1, vcl_slice_vec2, vcl_short_vec3, vcl_slice_vec4);
 
  423   if (retval != EXIT_SUCCESS)
 
  426   std::cout << 
" ** [vector|slice|slice|vector] **" << std::endl;
 
  427   retval = test<NumericT>(epsilon,
 
  428                           std_short_vec1, std_slice_vec2, std_slice_vec2, std_short_vec2,
 
  429                           vcl_short_vec1, vcl_slice_vec2, vcl_slice_vec3, vcl_short_vec4);
 
  430   if (retval != EXIT_SUCCESS)
 
  433   std::cout << 
" ** [vector|slice|slice|slice] **" << std::endl;
 
  434   retval = test<NumericT>(epsilon,
 
  435                           std_short_vec1, std_slice_vec2, std_slice_vec2, std_slice_vec2,
 
  436                           vcl_short_vec1, vcl_slice_vec2, vcl_slice_vec3, vcl_slice_vec4);
 
  437   if (retval != EXIT_SUCCESS)
 
  444   std::cout << 
" ** [slice|vector|vector|vector] **" << std::endl;
 
  445   retval = test<NumericT>(epsilon,
 
  446                           std_slice_vec1, std_short_vec2, std_short_vec2, std_short_vec2,
 
  447                           vcl_slice_vec1, vcl_short_vec2, vcl_short_vec3, vcl_short_vec4);
 
  448   if (retval != EXIT_SUCCESS)
 
  451   std::cout << 
" ** [slice|vector|vector|slice] **" << std::endl;
 
  452   retval = test<NumericT>(epsilon,
 
  453                           std_slice_vec1, std_short_vec2, std_short_vec2, std_slice_vec2,
 
  454                           vcl_slice_vec1, vcl_short_vec2, vcl_short_vec3, vcl_slice_vec4);
 
  455   if (retval != EXIT_SUCCESS)
 
  458   std::cout << 
" ** [slice|vector|slice|vector] **" << std::endl;
 
  459   retval = test<NumericT>(epsilon,
 
  460                           std_slice_vec1, std_short_vec2, std_slice_vec2, std_short_vec2,
 
  461                           vcl_slice_vec1, vcl_short_vec2, vcl_slice_vec3, vcl_short_vec4);
 
  462   if (retval != EXIT_SUCCESS)
 
  465   std::cout << 
" ** [slice|vector|slice|slice] **" << std::endl;
 
  466   retval = test<NumericT>(epsilon,
 
  467                           std_slice_vec1, std_short_vec2, std_slice_vec2, std_slice_vec2,
 
  468                           vcl_slice_vec1, vcl_short_vec2, vcl_slice_vec3, vcl_slice_vec4);
 
  469   if (retval != EXIT_SUCCESS)
 
  472   std::cout << 
" ** [slice|slice|vector|vector] **" << std::endl;
 
  473   retval = test<NumericT>(epsilon,
 
  474                           std_slice_vec1, std_slice_vec2, std_short_vec2, std_short_vec2,
 
  475                           vcl_slice_vec1, vcl_slice_vec2, vcl_short_vec3, vcl_short_vec4);
 
  476   if (retval != EXIT_SUCCESS)
 
  479   std::cout << 
" ** [slice|slice|vector|slice] **" << std::endl;
 
  480   retval = test<NumericT>(epsilon,
 
  481                           std_slice_vec1, std_slice_vec2, std_short_vec2, std_slice_vec2,
 
  482                           vcl_slice_vec1, vcl_slice_vec2, vcl_short_vec3, vcl_slice_vec4);
 
  483   if (retval != EXIT_SUCCESS)
 
  486   std::cout << 
" ** [slice|slice|slice|vector] **" << std::endl;
 
  487   retval = test<NumericT>(epsilon,
 
  488                           std_slice_vec1, std_slice_vec2, std_slice_vec2, std_short_vec2,
 
  489                           vcl_slice_vec1, vcl_slice_vec2, vcl_slice_vec3, vcl_short_vec4);
 
  490   if (retval != EXIT_SUCCESS)
 
  493   std::cout << 
" ** [slice|slice|slice|slice] **" << std::endl;
 
  494   retval = test<NumericT>(epsilon,
 
  495                           std_slice_vec1, std_slice_vec2, std_slice_vec2, std_slice_vec2,
 
  496                           vcl_slice_vec1, vcl_slice_vec2, vcl_slice_vec3, vcl_slice_vec4);
 
  497   if (retval != EXIT_SUCCESS)
 
  510    std::cout << std::endl;
 
  511    std::cout << 
"----------------------------------------------" << std::endl;
 
  512    std::cout << 
"----------------------------------------------" << std::endl;
 
  513    std::cout << 
"## Test :: Vector multiple inner products" << std::endl;
 
  514    std::cout << 
"----------------------------------------------" << std::endl;
 
  515    std::cout << 
"----------------------------------------------" << std::endl;
 
  516    std::cout << std::endl;
 
  518    int retval = EXIT_SUCCESS;
 
  520    std::cout << std::endl;
 
  521    std::cout << 
"----------------------------------------------" << std::endl;
 
  522    std::cout << std::endl;
 
  525       NumericT epsilon = 
static_cast<NumericT
>(1.0E-4);
 
  526       std::cout << 
"# Testing setup:" << std::endl;
 
  527       std::cout << 
"  eps:     " << epsilon << std::endl;
 
  528       std::cout << 
"  numeric: float" << std::endl;
 
  529       retval = test<NumericT>(epsilon);
 
  530       if ( retval == EXIT_SUCCESS )
 
  531          std::cout << 
"# Test passed" << std::endl;
 
  535    std::cout << std::endl;
 
  536    std::cout << 
"----------------------------------------------" << std::endl;
 
  537    std::cout << std::endl;
 
  538 #ifdef VIENNACL_WITH_OPENCL 
  544          NumericT epsilon = 1.0E-12;
 
  545          std::cout << 
"# Testing setup:" << std::endl;
 
  546          std::cout << 
"  eps:     " << epsilon << std::endl;
 
  547          std::cout << 
"  numeric: double" << std::endl;
 
  548          retval = test<NumericT>(epsilon);
 
  549          if ( retval == EXIT_SUCCESS )
 
  550            std::cout << 
"# Test passed" << std::endl;
 
  554       std::cout << std::endl;
 
  555       std::cout << 
"----------------------------------------------" << std::endl;
 
  556       std::cout << std::endl;
 
  559   std::cout << std::endl;
 
  560   std::cout << 
"------- Test completed --------" << std::endl;
 
  561   std::cout << std::endl;
 
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type...
Generic interface for the l^2-norm. See viennacl/linalg/vector_operations.hpp for implementations...
void finish()
Synchronizes the execution. finish() will only return after all compute kernels (CUDA, OpenCL) have completed. 
viennacl::enable_if< viennacl::is_stl< typename viennacl::traits::tag_of< VectorT1 >::type >::value, typename VectorT1::value_type >::type inner_prod(VectorT1 const &v1, VectorT2 const &v2)
viennacl::scalar< int > s2
viennacl::scalar< float > s1
T max(const T &lhs, const T &rhs)
Maximum. 
viennacl::ocl::device const & current_device()
Convenience function for returning the active device in the current context. 
Generic interface for the computation of inner products. See viennacl/linalg/vector_operations.hpp for implementations. 
Generic interface for the l^1-norm. See viennacl/linalg/vector_operations.hpp for implementations...
viennacl::vector< float > v1
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.) 
Tuple class holding pointers to multiple vectors. Mainly used as a temporary object returned from vie...
Class for representing strided subvectors of a bigger vector x. 
int test(Epsilon const &epsilon, STLVectorType1 &std_v1, STLVectorType2 &std_v2, STLVectorType3 &std_v3, STLVectorType4 &std_v4, ViennaCLVectorType1 &vcl_v1, ViennaCLVectorType2 &vcl_v2, ViennaCLVectorType3 &vcl_v3, ViennaCLVectorType4 &vcl_v4)
bool double_support() const 
ViennaCL convenience function: Returns true if the device supports double precision. 
matrix_range< MatrixType > project(MatrixType const &A, viennacl::range const &r1, viennacl::range const &r2)
vector_tuple< ScalarT > tie(vector_base< ScalarT > const &v0, vector_base< ScalarT > const &v1)
Proxy classes for vectors. 
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initial...
T norm_inf(std::vector< T, A > const &v1)
void copy(std::vector< NumericT > &cpu_vec, circulant_matrix< NumericT, AlignmentV > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...
A small collection of sequential random number generators. 
ScalarType diff(ScalarType const &s1, ScalarType const &s2)
int check(T1 const &t1, T2 const &t2, double epsilon)
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded. 
A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-use...
Generic interface for the l^infty-norm. See viennacl/linalg/vector_operations.hpp for implementations...
void fast_copy(const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)