45 std::vector<ScalarType> v(vcl_v.
size());
46 for (std::size_t i = 0; i < v.size(); ++i)
53 bool is_inclusive_scan)
55 std::vector<ScalarType> host_input(input.
size());
56 std::vector<ScalarType> host_result(result.
size());
62 if (is_inclusive_scan)
83 if (host_input[i] != host_result[i])
85 std::cout <<
"Fail at vector index " << i << std::endl;
86 std::cout <<
" result[" << i <<
"] = " << host_result[i] << std::endl;
87 std::cout <<
" Reference = " << host_input[i] << std::endl;
90 std::cout <<
" previous result[" << i-1 <<
"] = " << host_result[i-1] << std::endl;
91 std::cout <<
" previous Reference = " << host_input[i-1] << std::endl;
96 std::cout <<
"PASSED!" << std::endl;
101 static void test_scans(
unsigned int sz)
105 std::cout <<
"Initialize vector..." << std::endl;
110 std::cout <<
" --- Inclusive scan ---" << std::endl;
111 std::cout <<
"Separate vectors: ";
113 test_scan_values(vec1, vec2,
true);
115 std::cout <<
"In-place: ";
118 test_scan_values(vec1, vec2,
true);
119 std::cout <<
"Inclusive scan tested successfully!" << std::endl << std::endl;
123 std::cout <<
"Initialize vector..." << std::endl;
127 std::cout <<
" --- Exclusive scan ---" << std::endl;
128 std::cout <<
"Separate vectors: ";
130 test_scan_values(vec1, vec2,
false);
132 std::cout <<
"In-place: ";
135 test_scan_values(vec1, vec2,
false);
136 std::cout <<
"Exclusive scan tested successfully!" << std::endl << std::endl;
143 std::cout << std::endl <<
"----TEST INCLUSIVE and EXCLUSIVE SCAN----" << std::endl << std::endl;
144 std::cout <<
" //// Tiny vectors ////" << std::endl;
146 std::cout <<
" //// Small vectors ////" << std::endl;
148 std::cout <<
" //// Medium vectors ////" << std::endl;
150 std::cout <<
" //// Large vectors ////" << std::endl;
153 std::cout << std::endl <<
"--------TEST SUCCESSFULLY COMPLETED----------" << std::endl;
viennacl::scalar_expression< const viennacl::vector_base< NumericT >, const viennacl::vector_base< NumericT >, viennacl::op_sum > sum(viennacl::vector_base< NumericT > const &x)
User interface function for computing the sum of all elements of a vector.
void inclusive_scan(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2)
This function implements an inclusive scan.
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
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) ...
size_type size() const
Returns the length of the vector (cf. std::vector)
void exclusive_scan(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2)
This function implements an exclusive scan.
Implementation of the ViennaCL scalar class.