48 template<
typename ScalarType>
53 return (s1 - s2) /
std::max(std::fabs(s1), std::fabs(s2));
57 template<
typename ScalarType,
typename VCLVectorType>
60 std::vector<ScalarType> v2_cpu(v2.size());
65 for (
unsigned int i=0;i<v1.size(); ++i)
67 if (
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) ) > 0 )
69 ScalarType tmp = std::fabs(v2_cpu[i] - v1[i]) /
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) );
78 template<
typename ScalarType,
typename VCLMatrixType>
79 ScalarType diff(std::vector<std::vector<ScalarType> >
const & mat1, VCLMatrixType
const & mat2)
81 std::vector<std::vector<ScalarType> > mat2_cpu(mat2.size1(), std::vector<ScalarType>(mat2.size2()));
87 for (std::size_t i = 0; i < mat2_cpu.size(); ++i)
89 for (std::size_t j = 0; j < mat2_cpu[i].size(); ++j)
91 act = std::fabs(mat2_cpu[i][j] - mat1[i][j]) /
std::max( std::fabs(mat2_cpu[i][j]), std::fabs(mat1[i][j]) );
109 template<
typename NumericT,
typename Epsilon,
110 typename ReferenceMatrixTypeA,
typename ReferenceMatrixTypeB,
typename ReferenceMatrixTypeC,
111 typename MatrixTypeA,
typename MatrixTypeB,
typename MatrixTypeC>
114 ReferenceMatrixTypeA
const & A, ReferenceMatrixTypeA
const & A_trans,
115 ReferenceMatrixTypeB
const & B, ReferenceMatrixTypeB
const & B_trans,
116 ReferenceMatrixTypeC & C,
118 MatrixTypeA
const & vcl_A, MatrixTypeA
const & vcl_A_trans,
119 MatrixTypeB
const & vcl_B, MatrixTypeB
const & vcl_B_trans,
123 int retval = EXIT_SUCCESS;
128 for (std::size_t i=0; i<C.size(); ++i)
129 for (std::size_t j=0; j<C[i].size(); ++j)
132 for (std::size_t k=0; k<A[i].size(); ++k)
133 tmp += A[i][k] * B[k][j];
140 act_diff = std::fabs(
diff(C, vcl_C));
142 if ( act_diff > epsilon )
144 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
145 std::cout <<
" diff: " << act_diff << std::endl;
146 retval = EXIT_FAILURE;
149 std::cout <<
"Test C = A * B passed!" << std::endl;
152 for (std::size_t i=0; i<C.size(); ++i)
153 for (std::size_t j=0; j<C[i].size(); ++j)
156 for (std::size_t k=0; k<A[i].size(); ++k)
157 tmp += A[i][k] * B[k][j];
164 act_diff = std::fabs(
diff(C, vcl_C));
166 if ( act_diff > epsilon )
168 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
169 std::cout <<
" diff: " << act_diff << std::endl;
170 retval = EXIT_FAILURE;
173 std::cout <<
"Test C += A * B passed!" << std::endl;
175 for (std::size_t i=0; i<C.size(); ++i)
176 for (std::size_t j=0; j<C[i].size(); ++j)
179 for (std::size_t k=0; k<A[i].size(); ++k)
180 tmp += A[i][k] * B[k][j];
187 act_diff = std::fabs(
diff(C, vcl_C));
189 if ( act_diff > epsilon )
191 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
192 std::cout <<
" diff: " << act_diff << std::endl;
193 retval = EXIT_FAILURE;
196 std::cout <<
"Test C -= A * B passed!" << std::endl;
203 for (std::size_t i=0; i<C.size(); ++i)
204 for (std::size_t j=0; j<C[i].size(); ++j)
207 for (std::size_t k=0; k<A[i].size(); ++k)
208 tmp += A[i][k] * B_trans[j][k];
215 act_diff = std::fabs(
diff(C, vcl_C));
217 if ( act_diff > epsilon )
219 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
220 std::cout <<
" diff: " << act_diff << std::endl;
221 retval = EXIT_FAILURE;
224 std::cout <<
"Test C = A * trans(B) passed!" << std::endl;
227 for (std::size_t i=0; i<C.size(); ++i)
228 for (std::size_t j=0; j<C[i].size(); ++j)
231 for (std::size_t k=0; k<A[i].size(); ++k)
232 tmp += A[i][k] * B_trans[j][k];
239 act_diff = std::fabs(
diff(C, vcl_C));
241 if ( act_diff > epsilon )
243 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
244 std::cout <<
" diff: " << act_diff << std::endl;
245 retval = EXIT_FAILURE;
248 std::cout <<
"Test C += A * trans(B) passed!" << std::endl;
251 for (std::size_t i=0; i<C.size(); ++i)
252 for (std::size_t j=0; j<C[i].size(); ++j)
255 for (std::size_t k=0; k<A[i].size(); ++k)
256 tmp += A[i][k] * B_trans[j][k];
263 act_diff = std::fabs(
diff(C, vcl_C));
265 if ( act_diff > epsilon )
267 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
268 std::cout <<
" diff: " << act_diff << std::endl;
269 retval = EXIT_FAILURE;
272 std::cout <<
"Test C -= A * trans(B) passed!" << std::endl;
277 for (std::size_t i=0; i<C.size(); ++i)
278 for (std::size_t j=0; j<C[i].size(); ++j)
281 for (std::size_t k=0; k<A[i].size(); ++k)
282 tmp += A_trans[k][i] * B[k][j];
289 act_diff = std::fabs(
diff(C, vcl_C));
291 if ( act_diff > epsilon )
293 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
294 std::cout <<
" diff: " << act_diff << std::endl;
295 retval = EXIT_FAILURE;
298 std::cout <<
"Test C = trans(A) * B passed!" << std::endl;
301 for (std::size_t i=0; i<C.size(); ++i)
302 for (std::size_t j=0; j<C[i].size(); ++j)
305 for (std::size_t k=0; k<A[i].size(); ++k)
306 tmp += A_trans[k][i] * B[k][j];
313 act_diff = std::fabs(
diff(C, vcl_C));
315 if ( act_diff > epsilon )
317 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
318 std::cout <<
" diff: " << act_diff << std::endl;
319 retval = EXIT_FAILURE;
322 std::cout <<
"Test C += trans(A) * B passed!" << std::endl;
325 for (std::size_t i=0; i<C.size(); ++i)
326 for (std::size_t j=0; j<C[i].size(); ++j)
329 for (std::size_t k=0; k<A[i].size(); ++k)
330 tmp += A_trans[k][i] * B[k][j];
337 act_diff = std::fabs(
diff(C, vcl_C));
339 if ( act_diff > epsilon )
341 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
342 std::cout <<
" diff: " << act_diff << std::endl;
343 retval = EXIT_FAILURE;
346 std::cout <<
"Test C -= trans(A) * B passed!" << std::endl;
353 for (std::size_t i=0; i<C.size(); ++i)
354 for (std::size_t j=0; j<C[i].size(); ++j)
357 for (std::size_t k=0; k<A[i].size(); ++k)
358 tmp += A_trans[k][i] * B_trans[j][k];
365 act_diff = std::fabs(
diff(C, vcl_C));
367 if ( act_diff > epsilon )
369 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
370 std::cout <<
" diff: " << act_diff << std::endl;
371 retval = EXIT_FAILURE;
374 std::cout <<
"Test C = trans(A) * trans(B) passed!" << std::endl;
376 for (std::size_t i=0; i<C.size(); ++i)
377 for (std::size_t j=0; j<C[i].size(); ++j)
380 for (std::size_t k=0; k<A[i].size(); ++k)
381 tmp += A_trans[k][i] * B_trans[j][k];
388 act_diff = std::fabs(
diff(C, vcl_C));
390 if ( act_diff > epsilon )
392 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
393 std::cout <<
" diff: " << act_diff << std::endl;
394 retval = EXIT_FAILURE;
397 std::cout <<
"Test C += trans(A) * trans(B) passed!" << std::endl;
400 for (std::size_t i=0; i<C.size(); ++i)
401 for (std::size_t j=0; j<C[i].size(); ++j)
404 for (std::size_t k=0; k<A[i].size(); ++k)
405 tmp += A_trans[k][i] * B_trans[j][k];
412 act_diff = std::fabs(
diff(C, vcl_C));
414 if ( act_diff > epsilon )
416 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
417 std::cout <<
" diff: " << act_diff << std::endl;
418 retval = EXIT_FAILURE;
421 std::cout <<
"Test C -= trans(A) * trans(B) passed!" << std::endl;
431 template<
typename NumericT,
typename F_A,
typename F_B,
typename F_C,
typename Epsilon >
438 std::size_t matrix_size1 = 29;
439 std::size_t matrix_size2 = 47;
440 std::size_t matrix_size3 = 33;
451 std::vector<std::vector<NumericT> > A(matrix_size1, std::vector<NumericT>(matrix_size2));
452 std::vector<std::vector<NumericT> > big_A(4*matrix_size1, std::vector<NumericT>(4*matrix_size2,
NumericT(3.1415)));
454 std::vector<std::vector<NumericT> > B(matrix_size2, std::vector<NumericT>(matrix_size3));
455 std::vector<std::vector<NumericT> > big_B(4*matrix_size2, std::vector<NumericT>(4*matrix_size3,
NumericT(42.0)));
457 std::vector<std::vector<NumericT> > C(matrix_size1, std::vector<NumericT>(matrix_size3));
460 for (std::size_t i = 0; i < A.size(); ++i)
461 for (std::size_t j = 0; j < A[0].size(); ++j)
462 A[i][j] = static_cast<NumericT>(0.1) * randomNumber();
463 for (std::size_t i = 0; i < B.size(); ++i)
464 for (std::size_t j = 0; j < B[0].size(); ++j)
465 B[i][j] = static_cast<NumericT>(0.1) * randomNumber();
467 std::vector<std::vector<NumericT> > A_trans(A[0].
size(), std::vector<NumericT>(A.size()));
468 for (std::size_t i = 0; i < A.size(); ++i)
469 for (std::size_t j = 0; j < A[0].size(); ++j)
470 A_trans[j][i] = A[i][j];
472 std::vector<std::vector<NumericT> > big_A_trans(big_A[0].
size(), std::vector<NumericT>(big_A.size()));
473 for (std::size_t i = 0; i < big_A.size(); ++i)
474 for (std::size_t j = 0; j < big_A[0].size(); ++j)
475 big_A_trans[j][i] = big_A[i][j];
478 std::vector<std::vector<NumericT> > B_trans(B[0].
size(), std::vector<NumericT>(B.size()));
479 for (std::size_t i = 0; i < B.size(); ++i)
480 for (std::size_t j = 0; j < B[0].size(); ++j)
481 B_trans[j][i] = B[i][j];
483 std::vector<std::vector<NumericT> > big_B_trans(big_B[0].
size(), std::vector<NumericT>(big_B.size()));
484 for (std::size_t i = 0; i < big_B.size(); ++i)
485 for (std::size_t j = 0; j < big_B[0].size(); ++j)
486 big_B_trans[j][i] = big_B[i][j];
572 std::cout <<
"--- Part 1: Testing matrix-matrix products ---" << std::endl;
580 std::cout <<
"Now using A=matrix, B=matrix, C=matrix" << std::endl;
581 ret = test_prod<NumericT>(epsilon,
582 A, A_trans, B, B_trans, C,
586 if (ret != EXIT_SUCCESS)
592 std::cout <<
"Now using A=matrix, B=matrix, C=range" << std::endl;
593 ret = test_prod<NumericT>(epsilon,
594 A, A_trans, B, B_trans, C,
598 if (ret != EXIT_SUCCESS)
603 std::cout <<
"Now using A=matrix, B=matrix, C=slice" << std::endl;
604 ret = test_prod<NumericT>(epsilon,
605 A, A_trans, B, B_trans, C,
609 if (ret != EXIT_SUCCESS)
616 std::cout <<
"Now using A=matrix, B=range, C=matrix" << std::endl;
617 ret = test_prod<NumericT>(epsilon,
618 A, A_trans, B, B_trans, C,
620 vcl_range_B, vcl_range_B_trans,
622 if (ret != EXIT_SUCCESS)
628 std::cout <<
"Now using A=matrix, B=range, C=range" << std::endl;
629 ret = test_prod<NumericT>(epsilon,
630 A, A_trans, B, B_trans, C,
632 vcl_range_B, vcl_range_B_trans,
634 if (ret != EXIT_SUCCESS)
639 std::cout <<
"Now using A=matrix, B=range, C=slice" << std::endl;
640 ret = test_prod<NumericT>(epsilon,
641 A, A_trans, B, B_trans, C,
643 vcl_range_B, vcl_range_B_trans,
645 if (ret != EXIT_SUCCESS)
651 std::cout <<
"Now using A=matrix, B=slice, C=matrix" << std::endl;
652 ret = test_prod<NumericT>(epsilon,
653 A, A_trans, B, B_trans, C,
655 vcl_slice_B, vcl_slice_B_trans,
657 if (ret != EXIT_SUCCESS)
663 std::cout <<
"Now using A=matrix, B=slice, C=range" << std::endl;
664 ret = test_prod<NumericT>(epsilon,
665 A, A_trans, B, B_trans, C,
667 vcl_slice_B, vcl_slice_B_trans,
669 if (ret != EXIT_SUCCESS)
674 std::cout <<
"Now using A=matrix, B=slice, C=slice" << std::endl;
675 ret = test_prod<NumericT>(epsilon,
676 A, A_trans, B, B_trans, C,
678 vcl_slice_B, vcl_slice_B_trans,
680 if (ret != EXIT_SUCCESS)
690 std::cout <<
"Now using A=range, B=matrix, C=matrix" << std::endl;
691 ret = test_prod<NumericT>(epsilon,
692 A, A_trans, B, B_trans, C,
693 vcl_range_A, vcl_range_A_trans,
696 if (ret != EXIT_SUCCESS)
702 std::cout <<
"Now using A=range, B=matrix, C=range" << std::endl;
703 ret = test_prod<NumericT>(epsilon,
704 A, A_trans, B, B_trans, C,
705 vcl_range_A, vcl_range_A_trans,
708 if (ret != EXIT_SUCCESS)
713 std::cout <<
"Now using A=range, B=matrix, C=slice" << std::endl;
714 ret = test_prod<NumericT>(epsilon,
715 A, A_trans, B, B_trans, C,
716 vcl_range_A, vcl_range_A_trans,
719 if (ret != EXIT_SUCCESS)
726 std::cout <<
"Now using A=range, B=range, C=matrix" << std::endl;
727 ret = test_prod<NumericT>(epsilon,
728 A, A_trans, B, B_trans, C,
729 vcl_range_A, vcl_range_A_trans,
730 vcl_range_B, vcl_range_B_trans,
732 if (ret != EXIT_SUCCESS)
738 std::cout <<
"Now using A=range, B=range, C=range" << std::endl;
739 ret = test_prod<NumericT>(epsilon,
740 A, A_trans, B, B_trans, C,
741 vcl_range_A, vcl_range_A_trans,
742 vcl_range_B, vcl_range_B_trans,
744 if (ret != EXIT_SUCCESS)
749 std::cout <<
"Now using A=range, B=range, C=slice" << std::endl;
750 ret = test_prod<NumericT>(epsilon,
751 A, A_trans, B, B_trans, C,
752 vcl_range_A, vcl_range_A_trans,
753 vcl_range_B, vcl_range_B_trans,
755 if (ret != EXIT_SUCCESS)
761 std::cout <<
"Now using A=range, B=slice, C=matrix" << std::endl;
762 ret = test_prod<NumericT>(epsilon,
763 A, A_trans, B, B_trans, C,
764 vcl_range_A, vcl_range_A_trans,
765 vcl_slice_B, vcl_slice_B_trans,
767 if (ret != EXIT_SUCCESS)
773 std::cout <<
"Now using A=range, B=slice, C=range" << std::endl;
774 ret = test_prod<NumericT>(epsilon,
775 A, A_trans, B, B_trans, C,
776 vcl_range_A, vcl_range_A_trans,
777 vcl_slice_B, vcl_slice_B_trans,
779 if (ret != EXIT_SUCCESS)
784 std::cout <<
"Now using A=range, B=slice, C=slice" << std::endl;
785 ret = test_prod<NumericT>(epsilon,
786 A, A_trans, B, B_trans, C,
787 vcl_range_A, vcl_range_A_trans,
788 vcl_slice_B, vcl_slice_B_trans,
790 if (ret != EXIT_SUCCESS)
801 std::cout <<
"Now using A=slice, B=matrix, C=matrix" << std::endl;
802 ret = test_prod<NumericT>(epsilon,
803 A, A_trans, B, B_trans, C,
804 vcl_slice_A, vcl_slice_A_trans,
807 if (ret != EXIT_SUCCESS)
813 std::cout <<
"Now using A=slice, B=matrix, C=range" << std::endl;
814 ret = test_prod<NumericT>(epsilon,
815 A, A_trans, B, B_trans, C,
816 vcl_slice_A, vcl_slice_A_trans,
819 if (ret != EXIT_SUCCESS)
824 std::cout <<
"Now using A=slice, B=matrix, C=slice" << std::endl;
825 ret = test_prod<NumericT>(epsilon,
826 A, A_trans, B, B_trans, C,
827 vcl_slice_A, vcl_slice_A_trans,
830 if (ret != EXIT_SUCCESS)
837 std::cout <<
"Now using A=slice, B=range, C=matrix" << std::endl;
838 ret = test_prod<NumericT>(epsilon,
839 A, A_trans, B, B_trans, C,
840 vcl_slice_A, vcl_slice_A_trans,
841 vcl_range_B, vcl_range_B_trans,
843 if (ret != EXIT_SUCCESS)
849 std::cout <<
"Now using A=slice, B=range, C=range" << std::endl;
850 ret = test_prod<NumericT>(epsilon,
851 A, A_trans, B, B_trans, C,
852 vcl_slice_A, vcl_slice_A_trans,
853 vcl_range_B, vcl_range_B_trans,
855 if (ret != EXIT_SUCCESS)
860 std::cout <<
"Now using A=slice, B=range, C=slice" << std::endl;
861 ret = test_prod<NumericT>(epsilon,
862 A, A_trans, B, B_trans, C,
863 vcl_slice_A, vcl_slice_A_trans,
864 vcl_range_B, vcl_range_B_trans,
866 if (ret != EXIT_SUCCESS)
872 std::cout <<
"Now using A=slice, B=slice, C=matrix" << std::endl;
873 ret = test_prod<NumericT>(epsilon,
874 A, A_trans, B, B_trans, C,
875 vcl_slice_A, vcl_slice_A_trans,
876 vcl_slice_B, vcl_slice_B_trans,
878 if (ret != EXIT_SUCCESS)
884 std::cout <<
"Now using A=slice, B=slice, C=range" << std::endl;
885 ret = test_prod<NumericT>(epsilon,
886 A, A_trans, B, B_trans, C,
887 vcl_slice_A, vcl_slice_A_trans,
888 vcl_slice_B, vcl_slice_B_trans,
890 if (ret != EXIT_SUCCESS)
895 std::cout <<
"Now using A=slice, B=slice, C=slice" << std::endl;
896 ret = test_prod<NumericT>(epsilon,
897 A, A_trans, B, B_trans, C,
898 vcl_slice_A, vcl_slice_A_trans,
899 vcl_slice_B, vcl_slice_B_trans,
901 if (ret != EXIT_SUCCESS)
916 template<
typename NumericT,
typename Epsilon >
917 int test(Epsilon
const& epsilon)
921 std::cout <<
"///////////////////////////////////////" << std::endl;
922 std::cout <<
"/// Now testing A=row, B=row, C=row ///" << std::endl;
923 std::cout <<
"///////////////////////////////////////" << std::endl;
924 ret = test_prod<NumericT, viennacl::row_major, viennacl::row_major, viennacl::row_major>(epsilon);
925 if (ret != EXIT_SUCCESS)
928 std::cout <<
"///////////////////////////////////////" << std::endl;
929 std::cout <<
"/// Now testing A=row, B=row, C=col ///" << std::endl;
930 std::cout <<
"///////////////////////////////////////" << std::endl;
931 ret = test_prod<NumericT, viennacl::row_major, viennacl::row_major, viennacl::column_major>(epsilon);
932 if (ret != EXIT_SUCCESS)
935 std::cout <<
"///////////////////////////////////////" << std::endl;
936 std::cout <<
"/// Now testing A=row, B=col, C=row ///" << std::endl;
937 std::cout <<
"///////////////////////////////////////" << std::endl;
938 ret = test_prod<NumericT, viennacl::row_major, viennacl::column_major, viennacl::row_major>(epsilon);
939 if (ret != EXIT_SUCCESS)
942 std::cout <<
"///////////////////////////////////////" << std::endl;
943 std::cout <<
"/// Now testing A=row, B=col, C=col ///" << std::endl;
944 std::cout <<
"///////////////////////////////////////" << std::endl;
945 ret = test_prod<NumericT, viennacl::row_major, viennacl::column_major, viennacl::column_major>(epsilon);
946 if (ret != EXIT_SUCCESS)
949 std::cout <<
"///////////////////////////////////////" << std::endl;
950 std::cout <<
"/// Now testing A=col, B=row, C=row ///" << std::endl;
951 std::cout <<
"///////////////////////////////////////" << std::endl;
952 ret = test_prod<NumericT, viennacl::column_major, viennacl::row_major, viennacl::row_major>(epsilon);
953 if (ret != EXIT_SUCCESS)
956 std::cout <<
"///////////////////////////////////////" << std::endl;
957 std::cout <<
"/// Now testing A=col, B=row, C=col ///" << std::endl;
958 std::cout <<
"///////////////////////////////////////" << std::endl;
959 ret = test_prod<NumericT, viennacl::column_major, viennacl::row_major, viennacl::column_major>(epsilon);
960 if (ret != EXIT_SUCCESS)
963 std::cout <<
"///////////////////////////////////////" << std::endl;
964 std::cout <<
"/// Now testing A=col, B=col, C=row ///" << std::endl;
965 std::cout <<
"///////////////////////////////////////" << std::endl;
966 ret = test_prod<NumericT, viennacl::column_major, viennacl::column_major, viennacl::row_major>(epsilon);
967 if (ret != EXIT_SUCCESS)
970 std::cout <<
"///////////////////////////////////////" << std::endl;
971 std::cout <<
"/// Now testing A=col, B=col, C=col ///" << std::endl;
972 std::cout <<
"///////////////////////////////////////" << std::endl;
973 ret = test_prod<NumericT, viennacl::column_major, viennacl::column_major, viennacl::column_major>(epsilon);
974 if (ret != EXIT_SUCCESS)
987 std::cout << std::endl;
988 std::cout <<
"----------------------------------------------" << std::endl;
989 std::cout <<
"----------------------------------------------" << std::endl;
990 std::cout <<
"## Test :: BLAS 3 routines" << std::endl;
991 std::cout <<
"----------------------------------------------" << std::endl;
992 std::cout <<
"----------------------------------------------" << std::endl;
993 std::cout << std::endl;
995 int retval = EXIT_SUCCESS;
997 std::cout << std::endl;
998 std::cout <<
"----------------------------------------------" << std::endl;
999 std::cout << std::endl;
1002 NumericT epsilon =
NumericT(1.0E-3);
1003 std::cout <<
"# Testing setup:" << std::endl;
1004 std::cout <<
" eps: " << epsilon << std::endl;
1005 std::cout <<
" numeric: float" << std::endl;
1006 retval = test<NumericT>(epsilon);
1007 if ( retval == EXIT_SUCCESS )
1008 std::cout <<
"# Test passed" << std::endl;
1012 std::cout << std::endl;
1013 std::cout <<
"----------------------------------------------" << std::endl;
1014 std::cout << std::endl;
1015 #ifdef VIENNACL_WITH_OPENCL
1021 NumericT epsilon = 1.0E-11;
1022 std::cout <<
"# Testing setup:" << std::endl;
1023 std::cout <<
" eps: " << epsilon << std::endl;
1024 std::cout <<
" numeric: double" << std::endl;
1025 retval = test<NumericT>(epsilon);
1026 if ( retval == EXIT_SUCCESS )
1027 std::cout <<
"# Test passed" << std::endl;
1031 std::cout << std::endl;
1032 std::cout <<
"----------------------------------------------" << std::endl;
1033 std::cout << std::endl;
1036 std::cout << std::endl;
1037 std::cout <<
"------- Test completed --------" << std::endl;
1038 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...
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)
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.
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.)
int test_prod(Epsilon const &epsilon, ReferenceMatrixTypeA const &A, ReferenceMatrixTypeA const &A_trans, ReferenceMatrixTypeB const &B, ReferenceMatrixTypeB const &B_trans, ReferenceMatrixTypeC &C, MatrixTypeA const &vcl_A, MatrixTypeA const &vcl_A_trans, MatrixTypeB const &vcl_B, MatrixTypeB const &vcl_B_trans, MatrixTypeC &vcl_C)
ScalarType diff(ScalarType &s1, viennacl::scalar< ScalarType > &s2)
bool double_support() const
ViennaCL convenience function: Returns true if the device supports double precision.
Implementations of dense direct solvers are found here.
Proxy classes for matrices.
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;'.
int test(Epsilon const &epsilon)
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.