51 template<
typename ScalarType>
55 if (std::fabs(s1 - s2) > 0)
56 return (s1 - s2) /
std::max(std::fabs(s1), std::fabs(s2));
62 template<
typename ScalarType>
66 if (std::fabs(s1 - s2) > 0)
67 return (s1 - s2) /
std::max(std::fabs(s1), std::fabs(s2));
73 template<
typename ScalarType>
77 if (std::fabs(s1 - s2) > 0)
78 return (s1 - s2) /
std::max(std::fabs(s1), std::fabs(s2));
84 template<
typename ScalarType,
typename ViennaCLVectorType>
85 ScalarType diff(std::vector<ScalarType>
const &
v1, ViennaCLVectorType
const & vcl_vec)
87 std::vector<ScalarType> v2_cpu(vcl_vec.size());
92 for (std::size_t i=0;i<v1.size(); ++i)
95 if (
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) ) > 0 )
96 tmp = std::fabs(v2_cpu[i] - v1[i]) /
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) );
98 norm_inf_value = (tmp > norm_inf_value) ? tmp : norm_inf_value;
101 return norm_inf_value;
105 template<
typename T1,
typename T2>
106 int check(T1
const & t1, T2
const & t2,
double epsilon)
108 int retval = EXIT_SUCCESS;
110 double temp = std::fabs(
diff(t1, t2));
113 std::cout <<
"# Error! Relative difference: " << temp << std::endl;
114 retval = EXIT_FAILURE;
117 std::cout <<
"PASSED!" << std::endl;
125 template<
typename NumericT,
typename Epsilon,
typename STLVectorType,
typename ViennaCLVectorType1,
typename ViennaCLVectorType2 >
126 int test(Epsilon
const& epsilon,
127 STLVectorType & std_v1, STLVectorType & std_v2,
128 ViennaCLVectorType1 & vcl_v1, ViennaCLVectorType2 & vcl_v2)
130 int retval = EXIT_SUCCESS;
142 std::cout <<
"Checking for zero_vector initializer..." << std::endl;
143 std_v1 = std::vector<NumericT>(std_v1.size());
145 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
148 std::cout <<
"Checking for scalar_vector initializer..." << std::endl;
149 std_v1 = std::vector<NumericT>(std_v1.size(), cpu_result);
151 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
154 std_v1 = std::vector<NumericT>(std_v1.size(), gpu_result);
156 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
159 std::cout <<
"Checking for unit_vector initializer..." << std::endl;
160 std_v1 = std::vector<NumericT>(std_v1.size()); std_v1[5] =
NumericT(1);
162 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
166 for (std::size_t i=0; i<std_v1.size(); ++i)
168 std_v1[i] =
NumericT(1.0) + randomNumber();
169 std_v2[i] =
NumericT(1.0) + randomNumber();
175 std::cout <<
"Checking for successful copy..." << std::endl;
176 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
178 if (
check(std_v2, vcl_v2, epsilon) != EXIT_SUCCESS)
184 std::cout <<
"Testing simple assignments..." << std::endl;
187 for (std::size_t i=0; i<std_v1.size(); ++i)
188 std_v1[i] = std_v2[i];
192 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
197 for (std::size_t i=0; i<std_v1.size(); ++i)
198 std_v1[i] += std_v2[i];
202 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
207 for (std::size_t i=0; i<std_v1.size(); ++i)
208 std_v1[i] -= std_v2[i];
212 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
216 std::cout <<
"Testing composite assignments..." << std::endl;
218 for (std::size_t i=0; i<std_v1.size(); ++i)
219 std_v1[i] = std_v1[i] + std_v2[i];
223 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
227 for (std::size_t i=0; i<std_v1.size(); ++i)
228 std_v1[i] += alpha * std_v1[i] - beta * std_v2[i] + std_v1[i] / beta - std_v2[i] / alpha;
232 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
237 for (std::size_t i=0; i<std_v1.size(); ++i)
238 std_v1[i] = std_v1[i] - std_v2[i];
242 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
246 std::cout <<
"--- Testing reductions ---" << std::endl;
247 std::cout <<
"inner_prod..." << std::endl;
250 for (std::size_t i=0; i<std_v1.size(); ++i)
251 cpu_result += std_v1[i] * std_v2[i];
255 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
261 for (std::size_t i=0; i<std_v1.size(); ++i)
262 cpu_result += (std_v1[i] + std_v2[i]) * std_v2[i];
266 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
272 for (std::size_t i=0; i<std_v1.size(); ++i)
273 cpu_result += std_v1[i] * (std_v2[i] - std_v1[i]);
277 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
283 for (std::size_t i=0; i<std_v1.size(); ++i)
284 cpu_result += (std_v1[i] - std_v2[i]) * (std_v2[i] + std_v1[i]);
288 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
292 std::cout <<
"norm_1..." << std::endl;
295 for (std::size_t i=0; i<std_v1.size(); ++i)
296 cpu_result += std::fabs(std_v1[i]);
300 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
306 for (std::size_t i=0; i<std_v1.size(); ++i)
307 cpu_result += std::fabs(std_v1[i] + std_v2[i]);
311 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
315 std::cout <<
"norm_2..." << std::endl;
318 for (std::size_t i=0; i<std_v1.size(); ++i)
319 cpu_result += std_v1[i] * std_v1[i];
320 cpu_result = std::sqrt(cpu_result);
324 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
330 for (std::size_t i=0; i<std_v1.size(); ++i)
331 cpu_result += (std_v1[i] + std_v2[i]) * (std_v1[i] + std_v2[i]);
332 cpu_result = std::sqrt(cpu_result);
336 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
340 std::cout <<
"norm_inf..." << std::endl;
343 for (std::size_t i=0; i<std_v1.size(); ++i)
344 cpu_result =
std::max(cpu_result, std::fabs(std_v1[i]));
348 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
354 for (std::size_t i=0; i<std_v1.size(); ++i)
355 cpu_result =
std::max(cpu_result, std::fabs(std_v1[i] - std_v2[i]));
359 if (
check(cpu_result, gpu_result, epsilon) != EXIT_SUCCESS)
363 std::cout <<
"--- Testing elementwise operations (binary) ---" << std::endl;
364 std::cout <<
"x = element_prod(x, y)... ";
366 for (std::size_t i=0; i<std_v1.size(); ++i)
367 std_v1[i] = std_v1[i] * std_v2[i];
371 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
375 std::cout <<
"x = element_prod(x + y, y)... ";
377 for (std::size_t i=0; i<std_v1.size(); ++i)
378 std_v1[i] = (std_v1[i] + std_v2[i]) * std_v2[i];
382 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
386 std::cout <<
"x = element_prod(x, x + y)... ";
388 for (std::size_t i=0; i<std_v1.size(); ++i)
389 std_v1[i] = std_v1[i] * (std_v1[i] + std_v2[i]);
393 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
397 std::cout <<
"x = element_prod(x - y, y + x)... ";
399 for (std::size_t i=0; i<std_v1.size(); ++i)
400 std_v1[i] = (std_v1[i] - std_v2[i]) * (std_v2[i] + std_v1[i]);
404 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
410 std::cout <<
"x = element_div(x, y)... ";
412 for (std::size_t i=0; i<std_v1.size(); ++i)
413 std_v1[i] = std_v1[i] / std_v2[i];
417 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
421 std::cout <<
"x = element_div(x + y, y)... ";
423 for (std::size_t i=0; i<std_v1.size(); ++i)
424 std_v1[i] = (std_v1[i] + std_v2[i]) / std_v2[i];
428 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
432 std::cout <<
"x = element_div(x, x + y)... ";
434 for (std::size_t i=0; i<std_v1.size(); ++i)
435 std_v1[i] = std_v1[i] / (std_v1[i] + std_v2[i]);
439 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
443 std::cout <<
"x = element_div(x - y, y + x)... ";
445 for (std::size_t i=0; i<std_v1.size(); ++i)
446 std_v1[i] = (std_v1[i] - std_v2[i]) / (std_v2[i] + std_v1[i]);
450 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
455 std::cout <<
"x = element_pow(x, y)... ";
457 for (std::size_t i=0; i<std_v1.size(); ++i)
459 std_v1[i] =
NumericT(2.0) + randomNumber();
460 std_v2[i] =
NumericT(1.0) + randomNumber();
465 for (std::size_t i=0; i<std_v1.size(); ++i)
466 std_v1[i] = std::pow(std_v1[i], std_v2[i]);
470 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
474 std::cout <<
"x = element_pow(x + y, y)... ";
476 for (std::size_t i=0; i<std_v1.size(); ++i)
478 std_v1[i] =
NumericT(2.0) + randomNumber();
479 std_v2[i] =
NumericT(1.0) + randomNumber();
484 for (std::size_t i=0; i<std_v1.size(); ++i)
485 std_v1[i] = std::pow(std_v1[i] + std_v2[i], std_v2[i]);
489 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
493 std::cout <<
"x = element_pow(x, x + y)... ";
495 for (std::size_t i=0; i<std_v1.size(); ++i)
497 std_v1[i] =
NumericT(2.0) + randomNumber();
498 std_v2[i] =
NumericT(1.0) + randomNumber();
503 for (std::size_t i=0; i<std_v1.size(); ++i)
504 std_v1[i] = std::pow(std_v1[i], std_v1[i] + std_v2[i]);
508 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
512 std::cout <<
"x = element_pow(x - y, y + x)... ";
514 for (std::size_t i=0; i<std_v1.size(); ++i)
516 std_v1[i] =
NumericT(2.0) + randomNumber();
517 std_v2[i] =
NumericT(1.0) + randomNumber();
522 for (std::size_t i=0; i<std_v1.size(); ++i)
523 std_v1[i] = std::pow(std_v1[i] - std_v2[i], std_v2[i] + std_v1[i]);
527 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
531 std::cout <<
"--- Testing elementwise operations (unary) ---" << std::endl;
532 #define GENERATE_UNARY_OP_TEST(OPNAME) \
533 std_v1 = std::vector<NumericT>(std_v1.size(), NumericT(0.21)); \
534 for (std::size_t i=0; i<std_v1.size(); ++i) \
535 std_v2[i] = NumericT(3.1415) * std_v1[i]; \
536 viennacl::copy(std_v1.begin(), std_v1.end(), vcl_v1.begin()); \
537 viennacl::copy(std_v2.begin(), std_v2.end(), vcl_v2.begin()); \
539 for (std::size_t i=0; i<std_v1.size(); ++i) \
540 std_v1[i] = std::OPNAME(std_v2[i]); \
541 viennacl::scheduler::statement my_statement(vcl_v1, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_v2)); \
542 viennacl::scheduler::execute(my_statement); \
543 if (check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS) \
544 return EXIT_FAILURE; \
547 for (std::size_t i=0; i<std_v1.size(); ++i) \
548 std_v1[i] = std::OPNAME(std_v2[i] / NumericT(2)); \
549 viennacl::scheduler::statement my_statement(vcl_v1, viennacl::op_assign(), viennacl::linalg::element_##OPNAME(vcl_v2 / NumericT(2))); \
550 viennacl::scheduler::execute(my_statement); \
551 if (check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS) \
552 return EXIT_FAILURE; \
570 #undef GENERATE_UNARY_OP_TEST
572 std::cout <<
"--- Testing complicated composite operations ---" << std::endl;
573 std::cout <<
"x = inner_prod(x, y) * y..." << std::endl;
576 for (std::size_t i=0; i<std_v1.size(); ++i)
577 cpu_result += std_v1[i] * std_v2[i];
578 for (std::size_t i=0; i<std_v1.size(); ++i)
579 std_v1[i] = cpu_result * std_v2[i];
583 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
587 std::cout <<
"x = y / norm_1(x)..." << std::endl;
590 for (std::size_t i=0; i<std_v1.size(); ++i)
591 cpu_result += std::fabs(std_v1[i]);
592 for (std::size_t i=0; i<std_v1.size(); ++i)
593 std_v1[i] = std_v2[i] / cpu_result;
597 if (
check(std_v1, vcl_v1, epsilon) != EXIT_SUCCESS)
607 template<
typename NumericT,
typename Epsilon >
608 int test(Epsilon
const& epsilon)
610 int retval = EXIT_SUCCESS;
611 std::size_t
size = 24656;
615 std::cout <<
"Running tests for vector of size " << size << std::endl;
620 std::vector<NumericT> std_full_vec(size);
621 std::vector<NumericT> std_full_vec2(std_full_vec.size());
623 for (std::size_t i=0; i<std_full_vec.size(); ++i)
625 std_full_vec[i] =
NumericT(1.0) + randomNumber();
626 std_full_vec2[i] =
NumericT(1.0) + randomNumber();
629 std::vector<NumericT> std_range_vec (2 * std_full_vec.size() / 4 - std_full_vec.size() / 4);
630 std::vector<NumericT> std_range_vec2(2 * std_full_vec.size() / 4 - std_full_vec.size() / 4);
632 for (std::size_t i=0; i<std_range_vec.size(); ++i)
633 std_range_vec[i] = std_full_vec[i + std_full_vec.size() / 4];
634 for (std::size_t i=0; i<std_range_vec2.size(); ++i)
635 std_range_vec2[i] = std_full_vec2[i + 2 * std_full_vec2.size() / 4];
637 std::vector<NumericT> std_slice_vec (std_full_vec.size() / 4);
638 std::vector<NumericT> std_slice_vec2(std_full_vec.size() / 4);
640 for (std::size_t i=0; i<std_slice_vec.size(); ++i)
641 std_slice_vec[i] = std_full_vec[3*i + std_full_vec.size() / 4];
642 for (std::size_t i=0; i<std_slice_vec2.size(); ++i)
643 std_slice_vec2[i] = std_full_vec2[2*i + 2 * std_full_vec2.size() / 4];
652 viennacl::copy(std_full_vec2.begin(), std_full_vec2.end(), vcl_full_vec2.begin());
654 viennacl::range vcl_r1( vcl_full_vec.size() / 4, 2 * vcl_full_vec.size() / 4);
655 viennacl::range vcl_r2(2 * vcl_full_vec2.size() / 4, 3 * vcl_full_vec2.size() / 4);
663 std::vector<NumericT> std_short_vec(std_range_vec);
664 std::vector<NumericT> std_short_vec2(std_range_vec2);
666 std::cout <<
"Testing creation of vectors from range..." << std::endl;
667 if (
check(std_short_vec, vcl_short_vec, epsilon) != EXIT_SUCCESS)
669 if (
check(std_short_vec2, vcl_short_vec2, epsilon) != EXIT_SUCCESS)
673 viennacl::slice vcl_s1( vcl_full_vec.size() / 4, 3, vcl_full_vec.size() / 4);
674 viennacl::slice vcl_s2(2 * vcl_full_vec2.size() / 4, 2, vcl_full_vec2.size() / 4);
681 std::vector<NumericT> std_short_vec(std_slice_vec);
682 std::vector<NumericT> std_short_vec2(std_slice_vec2);
684 std::cout <<
"Testing creation of vectors from slice..." << std::endl;
685 if (
check(std_short_vec, vcl_short_vec, epsilon) != EXIT_SUCCESS)
687 if (
check(std_short_vec2, vcl_short_vec2, epsilon) != EXIT_SUCCESS)
695 std::cout <<
" ** vcl_v1 = vector, vcl_v2 = vector **" << std::endl;
696 retval = test<NumericT>(epsilon,
697 std_short_vec, std_short_vec2,
698 vcl_short_vec, vcl_short_vec2);
699 if (retval != EXIT_SUCCESS)
702 std::cout <<
" ** vcl_v1 = vector, vcl_v2 = range **" << std::endl;
703 retval = test<NumericT>(epsilon,
704 std_short_vec, std_short_vec2,
705 vcl_short_vec, vcl_range_vec2);
706 if (retval != EXIT_SUCCESS)
709 std::cout <<
" ** vcl_v1 = vector, vcl_v2 = slice **" << std::endl;
710 retval = test<NumericT>(epsilon,
711 std_short_vec, std_short_vec2,
712 vcl_short_vec, vcl_slice_vec2);
713 if (retval != EXIT_SUCCESS)
718 std::cout <<
" ** vcl_v1 = range, vcl_v2 = vector **" << std::endl;
719 retval = test<NumericT>(epsilon,
720 std_short_vec, std_short_vec2,
721 vcl_range_vec, vcl_short_vec2);
722 if (retval != EXIT_SUCCESS)
725 std::cout <<
" ** vcl_v1 = range, vcl_v2 = range **" << std::endl;
726 retval = test<NumericT>(epsilon,
727 std_short_vec, std_short_vec2,
728 vcl_range_vec, vcl_range_vec2);
729 if (retval != EXIT_SUCCESS)
732 std::cout <<
" ** vcl_v1 = range, vcl_v2 = slice **" << std::endl;
733 retval = test<NumericT>(epsilon,
734 std_short_vec, std_short_vec2,
735 vcl_range_vec, vcl_slice_vec2);
736 if (retval != EXIT_SUCCESS)
741 std::cout <<
" ** vcl_v1 = slice, vcl_v2 = vector **" << std::endl;
742 retval = test<NumericT>(epsilon,
743 std_short_vec, std_short_vec2,
744 vcl_slice_vec, vcl_short_vec2);
745 if (retval != EXIT_SUCCESS)
748 std::cout <<
" ** vcl_v1 = slice, vcl_v2 = range **" << std::endl;
749 retval = test<NumericT>(epsilon,
750 std_short_vec, std_short_vec2,
751 vcl_slice_vec, vcl_range_vec2);
752 if (retval != EXIT_SUCCESS)
755 std::cout <<
" ** vcl_v1 = slice, vcl_v2 = slice **" << std::endl;
756 retval = test<NumericT>(epsilon,
757 std_short_vec, std_short_vec2,
758 vcl_slice_vec, vcl_slice_vec2);
759 if (retval != EXIT_SUCCESS)
772 std::cout << std::endl;
773 std::cout <<
"----------------------------------------------" << std::endl;
774 std::cout <<
"----------------------------------------------" << std::endl;
775 std::cout <<
"## Test :: Vector" << std::endl;
776 std::cout <<
"----------------------------------------------" << std::endl;
777 std::cout <<
"----------------------------------------------" << std::endl;
778 std::cout << std::endl;
780 int retval = EXIT_SUCCESS;
782 std::cout << std::endl;
783 std::cout <<
"----------------------------------------------" << std::endl;
784 std::cout << std::endl;
787 NumericT epsilon =
static_cast<NumericT
>(1.0E-4);
788 std::cout <<
"# Testing setup:" << std::endl;
789 std::cout <<
" eps: " << epsilon << std::endl;
790 std::cout <<
" numeric: float" << std::endl;
791 retval = test<NumericT>(epsilon);
792 if ( retval == EXIT_SUCCESS )
793 std::cout <<
"# Test passed" << std::endl;
797 std::cout << std::endl;
798 std::cout <<
"----------------------------------------------" << std::endl;
799 std::cout << std::endl;
800 #ifdef VIENNACL_WITH_OPENCL
806 NumericT epsilon = 1.0E-12;
807 std::cout <<
"# Testing setup:" << std::endl;
808 std::cout <<
" eps: " << epsilon << std::endl;
809 std::cout <<
" numeric: double" << std::endl;
810 retval = test<NumericT>(epsilon);
811 if ( retval == EXIT_SUCCESS )
812 std::cout <<
"# Test passed" << std::endl;
816 std::cout << std::endl;
817 std::cout <<
"----------------------------------------------" << std::endl;
818 std::cout << std::endl;
821 std::cout << std::endl;
822 std::cout <<
"------- Test completed --------" << std::endl;
823 std::cout << std::endl;
viennacl::vector_expression< const vector_base< T >, const vector_base< T >, op_element_binary< op_div > > element_div(vector_base< T > const &v1, vector_base< T > const &v2)
T norm_2(std::vector< T, A > const &v1)
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...
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.
int check(T1 const &t1, T2 const &t2, double epsilon)
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)
void execute(statement const &s)
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.
A tag class representing inplace addition.
Generic interface for the l^1-norm. See viennacl/linalg/vector_operations.hpp for implementations...
viennacl::vector< float > v1
int test(Epsilon const &epsilon, STLVectorType &std_v1, STLVectorType &std_v2, ViennaCLVectorType1 &vcl_v1, ViennaCLVectorType2 &vcl_v2)
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.
#define GENERATE_UNARY_OP_TEST(OPNAME)
Proxy classes for vectors.
A tag class representing inplace subtraction.
Represents a vector consisting of 1 at a given index and zeros otherwise.
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.
T norm_1(std::vector< T, A > const &v1)
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
ScalarType diff(ScalarType const &s1, ScalarType const &s2)
viennacl::vector_expression< const vector_base< T >, const vector_base< T >, op_element_binary< op_prod > > element_prod(vector_base< T > const &v1, vector_base< T > const &v2)
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
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.
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)