57 for (
unsigned int i = 0; i < v.
size(); i++)
58 std::cout << std::setprecision(0) << std::fixed << v(i) <<
"\t";
66 std::vector<ScalarType> v(vcl_v.
size());
67 for (std::size_t i = 0; i < v.size(); ++i)
76 std::vector<ScalarType> vec(vcl_vec.
size());
80 double abs_error = std::fabs(static_cast<double>(i) * (static_cast<double>(i) + 1.) / 2. - static_cast<double>(vec[i]));
81 if (abs_error > static_cast<double>(
EPS) * static_cast<double>(vec[i]))
83 std::cout <<
"Fail at vector index " << i <<
" Absolute error: " << abs_error;
84 std::cout <<
"\t Relative error: " << std::setprecision(7) << abs_error / vec[i] * 100 <<
"%"<< std::endl;
85 std::cout <<
"vec[" << i <<
"] = " << vec[i] << std::endl;
96 std::vector<ScalarType> vec(vcl_vec.
size());
100 double abs_error = std::fabs(static_cast<double>(i) * (static_cast<double>(i) + 1.) / 2. - static_cast<double>(vec[i + 1]));
101 if (abs_error > static_cast<double>(
EPS) * static_cast<double>(vec[i]))
103 std::cout <<
"Fail at vector index " << i <<
" Absolute error: " << abs_error;
104 std::cout <<
"\t Relative error: " << std::setprecision(7) << abs_error / vec[i] * 100 <<
"%"<< std::endl;
105 std::cout <<
"vec[" << i <<
"] = " << vec[i] << std::endl;
117 unsigned int sz = 100000;
121 std::cout <<
"Initialize vector..." << std::endl;
126 std::cout <<
"Inclusive scan started!" << std::endl;
128 std::cout <<
"Inclusive scan finished!" << std::endl;
130 std::cout <<
"Testing inclusive scan results..." << std::endl;
132 std::cout <<
"Inclusive scan tested successfully!" << std::endl << std::endl;
136 std::cout <<
"Initialize vector..." << std::endl;
140 std::cout <<
"Exlusive scan started!" << std::endl;
142 std::cout <<
"Exclusive scan finished!" << std::endl;
144 std::cout <<
"Testing exclusive scan results..." << std::endl;
146 std::cout <<
"Exclusive scan tested successfully!" << std::endl << std::endl;
153 std::cout << std::endl <<
"----TEST INCLUSIVE and EXCLUSIVE SCAN----" << std::endl << std::endl;
156 std::cout << std::endl <<
"--------TEST SUCCESSFULLY COMPLETED----------" << std::endl;
Implementations of dense matrix related operations including matrix-vector products.
Implementation of the compressed_matrix class.
void inclusive_scan(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2)
This function implements an inclusive scan.
void test_inclusive_scan_values(viennacl::vector< ScalarType > &vcl_vec)
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) ...
void test_exclusive_scan_values(viennacl::vector< ScalarType > &vcl_vec)
size_type size() const
Returns the length of the vector (cf. std::vector)
void vector_print(viennacl::vector< ScalarType > &v)
void exclusive_scan(vector_base< NumericT > &vec1, vector_base< NumericT > &vec2)
This function implements an exclusive scan.
void init_vector(viennacl::vector< ScalarType > &vcl_v)
Implementation of the ViennaCL scalar class.