49 template<
typename ScalarType>
 
   54       return (s1 - s2) / 
std::max(std::fabs(s1), std::fabs(s2));
 
   58 template<
typename ScalarType, 
typename VCLVectorType>
 
   61    std::vector<ScalarType> v2_cpu(v2.size());
 
   66    for (
unsigned int i=0;i<v1.size(); ++i)
 
   68      if ( 
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) ) > 0 )
 
   70        ScalarType tmp = std::fabs(v2_cpu[i] - v1[i]) / 
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) );
 
   79 template<
typename ScalarType, 
typename VCLMatrixType>
 
   80 ScalarType diff(std::vector<std::vector<ScalarType> > 
const & mat1, VCLMatrixType 
const & mat2)
 
   82    std::vector<std::vector<ScalarType> > mat2_cpu(mat2.size1(), std::vector<ScalarType>(mat2.size2()));
 
   88     for (std::size_t i = 0; i < mat2_cpu.size(); ++i)
 
   90       for (std::size_t j = 0; j < mat2_cpu[i].size(); ++j)
 
   92          act = std::fabs(mat2_cpu[i][j] - mat1[i][j]) / 
std::max( std::fabs(mat2_cpu[i][j]), std::fabs(mat1[i][j]) );
 
  104 template<
typename NumericT, 
typename Epsilon,
 
  105           typename STLMatrixType, 
typename STLVectorType,
 
  106           typename VCLMatrixType, 
typename VCLVectorType1, 
typename VCLVectorType2>
 
  108                     STLMatrixType & std_m1, STLVectorType & std_v1, STLVectorType & std_v2,
 
  109                     VCLMatrixType & vcl_m1, VCLVectorType1 & vcl_v1, VCLVectorType2 & vcl_v2)
 
  111    int retval = EXIT_SUCCESS;
 
  124    std::cout << 
"Matrix-Vector product" << std::endl;
 
  125    for (std::size_t i=0; i<std_m1.size(); ++i)
 
  128      for (std::size_t j=0; j<std_m1[i].size(); ++j)
 
  129        std_v1[i] += std_m1[i][j] * std_v2[j];
 
  136    if ( std::fabs(
diff(std_v1, vcl_v1)) > epsilon )
 
  138       std::cout << 
"# Error at operation: matrix-vector product" << std::endl;
 
  139       std::cout << 
"  diff: " << std::fabs(
diff(std_v1, vcl_v1)) << std::endl;
 
  140       retval = EXIT_FAILURE;
 
  143    std::cout << 
"Matrix-Vector product with inplace-add" << std::endl;
 
  144    for (std::size_t i=0; i<std_m1.size(); ++i)
 
  146      for (std::size_t j=0; j<std_m1[i].size(); ++j)
 
  147        std_v1[i] += std_m1[i][j] * std_v2[j];
 
  154    if ( std::fabs(
diff(std_v1, vcl_v1)) > epsilon )
 
  156       std::cout << 
"# Error at operation: matrix-vector product" << std::endl;
 
  157       std::cout << 
"  diff: " << std::fabs(
diff(std_v1, vcl_v1)) << std::endl;
 
  158       retval = EXIT_FAILURE;
 
  161    std::cout << 
"Matrix-Vector product with inplace-sub" << std::endl;
 
  162    for (std::size_t i=0; i<std_m1.size(); ++i)
 
  164      for (std::size_t j=0; j<std_m1[i].size(); ++j)
 
  165        std_v1[i] -= std_m1[i][j] * std_v2[j];
 
  172    if ( std::fabs(
diff(std_v1, vcl_v1)) > epsilon )
 
  174       std::cout << 
"# Error at operation: matrix-vector product" << std::endl;
 
  175       std::cout << 
"  diff: " << std::fabs(
diff(std_v1, vcl_v1)) << std::endl;
 
  176       retval = EXIT_FAILURE;
 
  196    std::cout << 
"Matrix-Vector product with scaled vector" << std::endl;
 
  212    std::cout << 
"Matrix-Vector product with scaled matrix and scaled vector" << std::endl;
 
  229    std::cout << 
"Matrix-Vector product with scaled add" << std::endl;
 
  235    for (std::size_t i=0; i<std_m1.size(); ++i)
 
  238      for (std::size_t j=0; j<std_m1[i].size(); ++j)
 
  239        std_v1[i] += std_m1[i][j] * std_v2[j];
 
  240      std_v1[i] = alpha * std_v1[i] - beta * std_v1[i];
 
  247    if ( std::fabs(
diff(std_v1, vcl_v1)) > epsilon )
 
  249       std::cout << 
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
 
  250       std::cout << 
"  diff: " << std::fabs(
diff(std_v1, vcl_v1)) << std::endl;
 
  251       retval = EXIT_FAILURE;
 
  254    std::cout << 
"Matrix-Vector product with scaled add, inplace-add" << std::endl;
 
  258    for (std::size_t i=0; i<std_m1.size(); ++i)
 
  261      for (std::size_t j=0; j<std_m1[i].size(); ++j)
 
  262        tmp += std_m1[i][j] * std_v2[j];
 
  263      std_v1[i] += alpha * tmp - beta * std_v1[i];
 
  270    if ( std::fabs(
diff(std_v1, vcl_v1)) > epsilon )
 
  272       std::cout << 
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
 
  273       std::cout << 
"  diff: " << std::fabs(
diff(std_v1, vcl_v1)) << std::endl;
 
  274       retval = EXIT_FAILURE;
 
  277    std::cout << 
"Matrix-Vector product with scaled add, inplace-sub" << std::endl;
 
  281    for (std::size_t i=0; i<std_m1.size(); ++i)
 
  284      for (std::size_t j=0; j<std_m1[i].size(); ++j)
 
  285        tmp += std_m1[i][j] * std_v2[j];
 
  286      std_v1[i] -= alpha * tmp - beta * std_v1[i];
 
  293    if ( std::fabs(
diff(std_v1, vcl_v1)) > epsilon )
 
  295       std::cout << 
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
 
  296       std::cout << 
"  diff: " << std::fabs(
diff(std_v1, vcl_v1)) << std::endl;
 
  297       retval = EXIT_FAILURE;
 
  305    std::cout << 
"Transposed Matrix-Vector product" << std::endl;
 
  306    for (std::size_t i=0; i<std_m1[0].size(); ++i)
 
  309      for (std::size_t j=0; j<std_m1.size(); ++j)
 
  310        std_v2[i] += std_m1[j][i] * std_v1[j];
 
  317    if ( std::fabs(
diff(std_v2, vcl_v2)) > epsilon )
 
  319       std::cout << 
"# Error at operation: transposed matrix-vector product" << std::endl;
 
  320       std::cout << 
"  diff: " << std::fabs(
diff(std_v2, vcl_v2)) << std::endl;
 
  321       retval = EXIT_FAILURE;
 
  324    std::cout << 
"Transposed Matrix-Vector product, inplace-add" << std::endl;
 
  325    for (std::size_t i=0; i<std_m1[0].size(); ++i)
 
  327      for (std::size_t j=0; j<std_m1.size(); ++j)
 
  328        std_v2[i] += std_m1[j][i] * std_v1[j];
 
  335    if ( std::fabs(
diff(std_v2, vcl_v2)) > epsilon )
 
  337       std::cout << 
"# Error at operation: transposed matrix-vector product" << std::endl;
 
  338       std::cout << 
"  diff: " << std::fabs(
diff(std_v2, vcl_v2)) << std::endl;
 
  339       retval = EXIT_FAILURE;
 
  342    std::cout << 
"Transposed Matrix-Vector product, inplace-sub" << std::endl;
 
  343    for (std::size_t i=0; i<std_m1[0].size(); ++i)
 
  345      for (std::size_t j=0; j<std_m1.size(); ++j)
 
  346        std_v2[i] -= std_m1[j][i] * std_v1[j];
 
  353    if ( std::fabs(
diff(std_v2, vcl_v2)) > epsilon )
 
  355       std::cout << 
"# Error at operation: transposed matrix-vector product" << std::endl;
 
  356       std::cout << 
"  diff: " << std::fabs(
diff(std_v2, vcl_v2)) << std::endl;
 
  357       retval = EXIT_FAILURE;
 
  361    std::cout << 
"Transposed Matrix-Vector product with scaled add" << std::endl;
 
  362    for (std::size_t i=0; i<std_m1[0].size(); ++i)
 
  365      for (std::size_t j=0; j<std_m1.size(); ++j)
 
  366        tmp += std_m1[j][i] * std_v1[j];
 
  367      std_v2[i] = alpha * tmp + beta * std_v2[i];
 
  374    if ( std::fabs(
diff(std_v2, vcl_v2)) > epsilon )
 
  376       std::cout << 
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
 
  377       std::cout << 
"  diff: " << std::fabs(
diff(std_v2, vcl_v2)) << std::endl;
 
  378       retval = EXIT_FAILURE;
 
  381    std::cout << 
"Transposed Matrix-Vector product with scaled add, inplace-add" << std::endl;
 
  382    for (std::size_t i=0; i<std_m1[0].size(); ++i)
 
  385      for (std::size_t j=0; j<std_m1.size(); ++j)
 
  386        tmp += std_m1[j][i] * std_v1[j];
 
  387      std_v2[i] += alpha * tmp + beta * std_v2[i];
 
  394    if ( std::fabs(
diff(std_v2, vcl_v2)) > epsilon )
 
  396       std::cout << 
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
 
  397       std::cout << 
"  diff: " << std::fabs(
diff(std_v2, vcl_v2)) << std::endl;
 
  398       retval = EXIT_FAILURE;
 
  401    std::cout << 
"Transposed Matrix-Vector product with scaled add, inplace-sub" << std::endl;
 
  402    for (std::size_t i=0; i<std_m1[0].size(); ++i)
 
  405      for (std::size_t j=0; j<std_m1.size(); ++j)
 
  406        tmp += std_m1[j][i] * std_v1[j];
 
  407      std_v2[i] -= alpha * tmp + beta * std_v2[i];
 
  414    if ( std::fabs(
diff(std_v2, vcl_v2)) > epsilon )
 
  416       std::cout << 
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
 
  417       std::cout << 
"  diff: " << std::fabs(
diff(std_v2, vcl_v2)) << std::endl;
 
  418       retval = EXIT_FAILURE;
 
  430 template< 
typename NumericT, 
typename F, 
typename Epsilon >
 
  431 int test(Epsilon 
const& epsilon)
 
  433    int retval = EXIT_SUCCESS;
 
  437    std::size_t num_rows = 141;
 
  438    std::size_t num_cols = 79;
 
  441    std::vector<NumericT> std_v1(num_rows);
 
  442    for (std::size_t i = 0; i < std_v1.size(); ++i)
 
  443      std_v1[i] = randomNumber();
 
  444    std::vector<NumericT> std_v2 = std::vector<NumericT>(num_cols, 
NumericT(3.1415));
 
  447    std::vector<std::vector<NumericT> > std_m1(std_v1.size(), std::vector<NumericT>(std_v2.size()));
 
  449    for (std::size_t i = 0; i < std_m1.size(); ++i)
 
  450       for (std::size_t j = 0; j < std_m1[i].size(); ++j)
 
  451         std_m1[i][j] = static_cast<NumericT>(0.1) * randomNumber();
 
  454    std::vector<std::vector<NumericT> > std_m2(std_v1.size(), std::vector<NumericT>(std_v1.size()));
 
  456    for (std::size_t i = 0; i < std_m2.size(); ++i)
 
  458       for (std::size_t j = 0; j < std_m2[i].size(); ++j)
 
  459          std_m2[i][j] = static_cast<NumericT>(-0.1) * randomNumber();
 
  460       std_m2[i][i] = 
static_cast<NumericT>(2) + randomNumber();
 
  530    std::cout << 
"------------ Testing rank-1-updates and matrix-vector products ------------------" << std::endl;
 
  532    std::cout << 
"* m = full, v1 = full, v2 = full" << std::endl;
 
  533    retval = test_prod_rank1<NumericT>(epsilon,
 
  534                                       std_m1, std_v1, std_v2,
 
  535                                       vcl_m1_native, vcl_v1_native, vcl_v2_native);
 
  536    if (retval == EXIT_FAILURE)
 
  538      std::cout << 
" --- FAILED! ---" << std::endl;
 
  542      std::cout << 
" --- PASSED ---" << std::endl;
 
  545    std::cout << 
"* m = full, v1 = full, v2 = range" << std::endl;
 
  546    retval = test_prod_rank1<NumericT>(epsilon,
 
  547                                       std_m1, std_v1, std_v2,
 
  548                                       vcl_m1_native, vcl_v1_native, vcl_v2_range);
 
  549    if (retval == EXIT_FAILURE)
 
  551      std::cout << 
" --- FAILED! ---" << std::endl;
 
  555      std::cout << 
" --- PASSED ---" << std::endl;
 
  558    std::cout << 
"* m = full, v1 = full, v2 = slice" << std::endl;
 
  559    retval = test_prod_rank1<NumericT>(epsilon,
 
  560                                       std_m1, std_v1, std_v2,
 
  561                                       vcl_m1_native, vcl_v1_native, vcl_v2_slice);
 
  562    if (retval == EXIT_FAILURE)
 
  564      std::cout << 
" --- FAILED! ---" << std::endl;
 
  568      std::cout << 
" --- PASSED ---" << std::endl;
 
  574    std::cout << 
"* m = full, v1 = range, v2 = full" << std::endl;
 
  575    retval = test_prod_rank1<NumericT>(epsilon,
 
  576                                       std_m1, std_v1, std_v2,
 
  577                                       vcl_m1_native, vcl_v1_range, vcl_v2_native);
 
  578    if (retval == EXIT_FAILURE)
 
  580      std::cout << 
" --- FAILED! ---" << std::endl;
 
  584      std::cout << 
" --- PASSED ---" << std::endl;
 
  587    std::cout << 
"* m = full, v1 = range, v2 = range" << std::endl;
 
  588    retval = test_prod_rank1<NumericT>(epsilon,
 
  589                                       std_m1, std_v1, std_v2,
 
  590                                       vcl_m1_native, vcl_v1_range, vcl_v2_range);
 
  591    if (retval == EXIT_FAILURE)
 
  593      std::cout << 
" --- FAILED! ---" << std::endl;
 
  597      std::cout << 
" --- PASSED ---" << std::endl;
 
  600    std::cout << 
"* m = full, v1 = range, v2 = slice" << std::endl;
 
  601    retval = test_prod_rank1<NumericT>(epsilon,
 
  602                                       std_m1, std_v1, std_v2,
 
  603                                       vcl_m1_native, vcl_v1_range, vcl_v2_slice);
 
  604    if (retval == EXIT_FAILURE)
 
  606      std::cout << 
" --- FAILED! ---" << std::endl;
 
  610      std::cout << 
" --- PASSED ---" << std::endl;
 
  616    std::cout << 
"* m = full, v1 = slice, v2 = full" << std::endl;
 
  617    retval = test_prod_rank1<NumericT>(epsilon,
 
  618                                       std_m1, std_v1, std_v2,
 
  619                                       vcl_m1_native, vcl_v1_slice, vcl_v2_native);
 
  620    if (retval == EXIT_FAILURE)
 
  622      std::cout << 
" --- FAILED! ---" << std::endl;
 
  626      std::cout << 
" --- PASSED ---" << std::endl;
 
  629    std::cout << 
"* m = full, v1 = slice, v2 = range" << std::endl;
 
  630    retval = test_prod_rank1<NumericT>(epsilon,
 
  631                                       std_m1, std_v1, std_v2,
 
  632                                       vcl_m1_native, vcl_v1_slice, vcl_v2_range);
 
  633    if (retval == EXIT_FAILURE)
 
  635      std::cout << 
" --- FAILED! ---" << std::endl;
 
  639      std::cout << 
" --- PASSED ---" << std::endl;
 
  642    std::cout << 
"* m = full, v1 = slice, v2 = slice" << std::endl;
 
  643    retval = test_prod_rank1<NumericT>(epsilon,
 
  644                                       std_m1, std_v1, std_v2,
 
  645                                       vcl_m1_native, vcl_v1_slice, vcl_v2_slice);
 
  646    if (retval == EXIT_FAILURE)
 
  648      std::cout << 
" --- FAILED! ---" << std::endl;
 
  652      std::cout << 
" --- PASSED ---" << std::endl;
 
  657    std::cout << 
"* m = range, v1 = full, v2 = full" << std::endl;
 
  658    retval = test_prod_rank1<NumericT>(epsilon,
 
  659                                       std_m1, std_v1, std_v2,
 
  660                                       vcl_m1_range, vcl_v1_native, vcl_v2_native);
 
  661    if (retval == EXIT_FAILURE)
 
  663      std::cout << 
" --- FAILED! ---" << std::endl;
 
  667      std::cout << 
" --- PASSED ---" << std::endl;
 
  670    std::cout << 
"* m = range, v1 = full, v2 = range" << std::endl;
 
  671    retval = test_prod_rank1<NumericT>(epsilon,
 
  672                                       std_m1, std_v1, std_v2,
 
  673                                       vcl_m1_range, vcl_v1_native, vcl_v2_range);
 
  674    if (retval == EXIT_FAILURE)
 
  676      std::cout << 
" --- FAILED! ---" << std::endl;
 
  680      std::cout << 
" --- PASSED ---" << std::endl;
 
  683    std::cout << 
"* m = range, v1 = full, v2 = slice" << std::endl;
 
  684    retval = test_prod_rank1<NumericT>(epsilon,
 
  685                                       std_m1, std_v1, std_v2,
 
  686                                       vcl_m1_range, vcl_v1_native, vcl_v2_slice);
 
  687    if (retval == EXIT_FAILURE)
 
  689      std::cout << 
" --- FAILED! ---" << std::endl;
 
  693      std::cout << 
" --- PASSED ---" << std::endl;
 
  699    std::cout << 
"* m = range, v1 = range, v2 = full" << std::endl;
 
  700    retval = test_prod_rank1<NumericT>(epsilon,
 
  701                                       std_m1, std_v1, std_v2,
 
  702                                       vcl_m1_range, vcl_v1_range, vcl_v2_native);
 
  703    if (retval == EXIT_FAILURE)
 
  705      std::cout << 
" --- FAILED! ---" << std::endl;
 
  709      std::cout << 
" --- PASSED ---" << std::endl;
 
  712    std::cout << 
"* m = range, v1 = range, v2 = range" << std::endl;
 
  713    retval = test_prod_rank1<NumericT>(epsilon,
 
  714                                       std_m1, std_v1, std_v2,
 
  715                                       vcl_m1_range, vcl_v1_range, vcl_v2_range);
 
  716    if (retval == EXIT_FAILURE)
 
  718      std::cout << 
" --- FAILED! ---" << std::endl;
 
  722      std::cout << 
" --- PASSED ---" << std::endl;
 
  725    std::cout << 
"* m = range, v1 = range, v2 = slice" << std::endl;
 
  726    retval = test_prod_rank1<NumericT>(epsilon,
 
  727                                       std_m1, std_v1, std_v2,
 
  728                                       vcl_m1_range, vcl_v1_range, vcl_v2_slice);
 
  729    if (retval == EXIT_FAILURE)
 
  731      std::cout << 
" --- FAILED! ---" << std::endl;
 
  735      std::cout << 
" --- PASSED ---" << std::endl;
 
  741    std::cout << 
"* m = range, v1 = slice, v2 = full" << std::endl;
 
  742    retval = test_prod_rank1<NumericT>(epsilon,
 
  743                                       std_m1, std_v1, std_v2,
 
  744                                       vcl_m1_range, vcl_v1_slice, vcl_v2_native);
 
  745    if (retval == EXIT_FAILURE)
 
  747      std::cout << 
" --- FAILED! ---" << std::endl;
 
  751      std::cout << 
" --- PASSED ---" << std::endl;
 
  754    std::cout << 
"* m = range, v1 = slice, v2 = range" << std::endl;
 
  755    retval = test_prod_rank1<NumericT>(epsilon,
 
  756                                       std_m1, std_v1, std_v2,
 
  757                                       vcl_m1_range, vcl_v1_slice, vcl_v2_range);
 
  758    if (retval == EXIT_FAILURE)
 
  760      std::cout << 
" --- FAILED! ---" << std::endl;
 
  764      std::cout << 
" --- PASSED ---" << std::endl;
 
  767    std::cout << 
"* m = range, v1 = slice, v2 = slice" << std::endl;
 
  768    retval = test_prod_rank1<NumericT>(epsilon,
 
  769                                       std_m1, std_v1, std_v2,
 
  770                                       vcl_m1_range, vcl_v1_slice, vcl_v2_slice);
 
  771    if (retval == EXIT_FAILURE)
 
  773      std::cout << 
" --- FAILED! ---" << std::endl;
 
  777      std::cout << 
" --- PASSED ---" << std::endl;
 
  782    std::cout << 
"* m = slice, v1 = full, v2 = full" << std::endl;
 
  783    retval = test_prod_rank1<NumericT>(epsilon,
 
  784                                       std_m1, std_v1, std_v2,
 
  785                                       vcl_m1_slice, vcl_v1_native, vcl_v2_native);
 
  786    if (retval == EXIT_FAILURE)
 
  788      std::cout << 
" --- FAILED! ---" << std::endl;
 
  792      std::cout << 
" --- PASSED ---" << std::endl;
 
  795    std::cout << 
"* m = slice, v1 = full, v2 = range" << std::endl;
 
  796    retval = test_prod_rank1<NumericT>(epsilon,
 
  797                                       std_m1, std_v1, std_v2,
 
  798                                       vcl_m1_slice, vcl_v1_native, vcl_v2_range);
 
  799    if (retval == EXIT_FAILURE)
 
  801      std::cout << 
" --- FAILED! ---" << std::endl;
 
  805      std::cout << 
" --- PASSED ---" << std::endl;
 
  808    std::cout << 
"* m = slice, v1 = full, v2 = slice" << std::endl;
 
  809    retval = test_prod_rank1<NumericT>(epsilon,
 
  810                                       std_m1, std_v1, std_v2,
 
  811                                       vcl_m1_slice, vcl_v1_native, vcl_v2_slice);
 
  812    if (retval == EXIT_FAILURE)
 
  814      std::cout << 
" --- FAILED! ---" << std::endl;
 
  818      std::cout << 
" --- PASSED ---" << std::endl;
 
  824    std::cout << 
"* m = slice, v1 = range, v2 = full" << std::endl;
 
  825    retval = test_prod_rank1<NumericT>(epsilon,
 
  826                                       std_m1, std_v1, std_v2,
 
  827                                       vcl_m1_slice, vcl_v1_range, vcl_v2_native);
 
  828    if (retval == EXIT_FAILURE)
 
  830      std::cout << 
" --- FAILED! ---" << std::endl;
 
  834      std::cout << 
" --- PASSED ---" << std::endl;
 
  837    std::cout << 
"* m = slice, v1 = range, v2 = range" << std::endl;
 
  838    retval = test_prod_rank1<NumericT>(epsilon,
 
  839                                       std_m1, std_v1, std_v2,
 
  840                                       vcl_m1_slice, vcl_v1_range, vcl_v2_range);
 
  841    if (retval == EXIT_FAILURE)
 
  843      std::cout << 
" --- FAILED! ---" << std::endl;
 
  847      std::cout << 
" --- PASSED ---" << std::endl;
 
  850    std::cout << 
"* m = slice, v1 = range, v2 = slice" << std::endl;
 
  851    retval = test_prod_rank1<NumericT>(epsilon,
 
  852                                       std_m1, std_v1, std_v2,
 
  853                                       vcl_m1_slice, vcl_v1_range, vcl_v2_slice);
 
  854    if (retval == EXIT_FAILURE)
 
  856      std::cout << 
" --- FAILED! ---" << std::endl;
 
  860      std::cout << 
" --- PASSED ---" << std::endl;
 
  866    std::cout << 
"* m = slice, v1 = slice, v2 = full" << std::endl;
 
  867    retval = test_prod_rank1<NumericT>(epsilon,
 
  868                                       std_m1, std_v1, std_v2,
 
  869                                       vcl_m1_slice, vcl_v1_slice, vcl_v2_native);
 
  870    if (retval == EXIT_FAILURE)
 
  872      std::cout << 
" --- FAILED! ---" << std::endl;
 
  876      std::cout << 
" --- PASSED ---" << std::endl;
 
  879    std::cout << 
"* m = slice, v1 = slice, v2 = range" << std::endl;
 
  880    retval = test_prod_rank1<NumericT>(epsilon,
 
  881                                       std_m1, std_v1, std_v2,
 
  882                                       vcl_m1_slice, vcl_v1_slice, vcl_v2_range);
 
  883    if (retval == EXIT_FAILURE)
 
  885      std::cout << 
" --- FAILED! ---" << std::endl;
 
  889      std::cout << 
" --- PASSED ---" << std::endl;
 
  892    std::cout << 
"* m = slice, v1 = slice, v2 = slice" << std::endl;
 
  893    retval = test_prod_rank1<NumericT>(epsilon,
 
  894                                       std_m1, std_v1, std_v2,
 
  895                                       vcl_m1_slice, vcl_v1_slice, vcl_v2_slice);
 
  896    if (retval == EXIT_FAILURE)
 
  898      std::cout << 
" --- FAILED! ---" << std::endl;
 
  902      std::cout << 
" --- PASSED ---" << std::endl;
 
  911    std::cout << std::endl;
 
  912    std::cout << 
"----------------------------------------------" << std::endl;
 
  913    std::cout << 
"----------------------------------------------" << std::endl;
 
  914    std::cout << 
"## Test :: Matrix" << std::endl;
 
  915    std::cout << 
"----------------------------------------------" << std::endl;
 
  916    std::cout << 
"----------------------------------------------" << std::endl;
 
  917    std::cout << std::endl;
 
  919    int retval = EXIT_SUCCESS;
 
  921    std::cout << std::endl;
 
  922    std::cout << 
"----------------------------------------------" << std::endl;
 
  923    std::cout << std::endl;
 
  926       NumericT epsilon = 
NumericT(1.0E-3);
 
  927       std::cout << 
"# Testing setup:" << std::endl;
 
  928       std::cout << 
"  eps:     " << epsilon << std::endl;
 
  929       std::cout << 
"  numeric: float" << std::endl;
 
  930       std::cout << 
"  layout: row-major" << std::endl;
 
  931       retval = test<NumericT, viennacl::row_major>(epsilon);
 
  932       if ( retval == EXIT_SUCCESS )
 
  933          std::cout << 
"# Test passed" << std::endl;
 
  937    std::cout << std::endl;
 
  938    std::cout << 
"----------------------------------------------" << std::endl;
 
  939    std::cout << std::endl;
 
  942       NumericT epsilon = 
NumericT(1.0E-3);
 
  943       std::cout << 
"# Testing setup:" << std::endl;
 
  944       std::cout << 
"  eps:     " << epsilon << std::endl;
 
  945       std::cout << 
"  numeric: float" << std::endl;
 
  946       std::cout << 
"  layout: column-major" << std::endl;
 
  947       retval = test<NumericT, viennacl::column_major>(epsilon);
 
  948       if ( retval == EXIT_SUCCESS )
 
  949          std::cout << 
"# Test passed" << std::endl;
 
  953    std::cout << std::endl;
 
  954    std::cout << 
"----------------------------------------------" << std::endl;
 
  955    std::cout << std::endl;
 
  958 #ifdef VIENNACL_WITH_OPENCL 
  964          NumericT epsilon = 1.0E-11;
 
  965          std::cout << 
"# Testing setup:" << std::endl;
 
  966          std::cout << 
"  eps:     " << epsilon << std::endl;
 
  967          std::cout << 
"  numeric: double" << std::endl;
 
  968          std::cout << 
"  layout: row-major" << std::endl;
 
  969          retval = test<NumericT, viennacl::row_major>(epsilon);
 
  970             if ( retval == EXIT_SUCCESS )
 
  971                std::cout << 
"# Test passed" << std::endl;
 
  975       std::cout << std::endl;
 
  976       std::cout << 
"----------------------------------------------" << std::endl;
 
  977       std::cout << std::endl;
 
  980          NumericT epsilon = 1.0E-11;
 
  981          std::cout << 
"# Testing setup:" << std::endl;
 
  982          std::cout << 
"  eps:     " << epsilon << std::endl;
 
  983          std::cout << 
"  numeric: double" << std::endl;
 
  984          std::cout << 
"  layout: column-major" << std::endl;
 
  985          retval = test<NumericT, viennacl::column_major>(epsilon);
 
  986             if ( retval == EXIT_SUCCESS )
 
  987                std::cout << 
"# Test passed" << std::endl;
 
  991       std::cout << std::endl;
 
  992       std::cout << 
"----------------------------------------------" << std::endl;
 
  993       std::cout << std::endl;
 
  996    std::cout << std::endl;
 
  997    std::cout << 
"------- Test completed --------" << std::endl;
 
  998    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...
ScalarType diff(ScalarType &s1, viennacl::scalar< ScalarType > &s2)
Class for representing strided submatrices of a bigger matrix A. 
std::vector< std::vector< NumericT > > trans(std::vector< std::vector< NumericT > > const &A)
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class. 
Some helper routines for reading/writing/printing scheduler expressions. 
A tag class representing assignment. 
void finish()
Synchronizes the execution. finish() will only return after all compute kernels (CUDA, OpenCL) have completed. 
void execute(statement const &s)
int test(Epsilon const &epsilon)
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. 
A tag class representing inplace addition. 
int test_prod_rank1(Epsilon const &epsilon, STLMatrixType &std_m1, STLVectorType &std_v1, STLVectorType &std_v2, VCLMatrixType &vcl_m1, VCLVectorType1 &vcl_v1, VCLVectorType2 &vcl_v2)
viennacl::vector< float > v1
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.) 
Class for representing non-strided subvectors of a bigger vector x. 
Class for representing strided subvectors of a bigger vector x. 
bool double_support() const 
ViennaCL convenience function: Returns true if the device supports double precision. 
Implementations of LU factorization for row-major and column-major dense matrices. 
Implementations of dense direct solvers are found here. 
A tag class representing inplace subtraction. 
viennacl::vector< int > v2
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
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. 
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded. 
Provides the datastructures for dealing with a single statement such as 'x = y + z;'. 
Class for representing non-strided submatrices of a bigger matrix A. 
The main class for representing a statement such as x = inner_prod(y,z); at runtime. 
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded. 
Implementation of the ViennaCL scalar class.