31 #include <boost/numeric/ublas/io.hpp>
32 #include <boost/numeric/ublas/triangular.hpp>
33 #include <boost/numeric/ublas/matrix_sparse.hpp>
34 #include <boost/numeric/ublas/matrix.hpp>
35 #include <boost/numeric/ublas/matrix_proxy.hpp>
36 #include <boost/numeric/ublas/lu.hpp>
37 #include <boost/numeric/ublas/io.hpp>
43 #define VIENNACL_WITH_UBLAS 1
60 template<
typename ScalarType>
69 template<
typename ScalarType,
typename VCLVectorType>
72 ublas::vector<ScalarType> v2_cpu(v2.size());
76 for (
unsigned int i=0;i<v1.size(); ++i)
78 if (v2_cpu[i] != v1[i])
85 template<
typename ScalarType,
typename VCLMatrixType>
86 ScalarType diff(ublas::matrix<ScalarType>
const & mat1, VCLMatrixType
const & mat2)
88 ublas::matrix<ScalarType> mat2_cpu(mat2.size1(), mat2.size2());
92 for (
unsigned int i = 0; i < mat2_cpu.size1(); ++i)
94 for (
unsigned int j = 0; j < mat2_cpu.size2(); ++j)
96 if (mat2_cpu(i,j) != mat1(i,j))
108 typename UblasMatrixType,
typename UblasVectorType,
109 typename VCLMatrixType,
typename VCLVectorType1,
typename VCLVectorType2>
110 int test_prod_rank1(UblasMatrixType & ublas_m1, UblasVectorType & ublas_v1, UblasVectorType & ublas_v2,
111 VCLMatrixType & vcl_m1, VCLVectorType1 & vcl_v1, VCLVectorType2 & vcl_v2)
113 int retval = EXIT_SUCCESS;
116 ublas_v1 = ublas::scalar_vector<NumericT>(ublas_v1.size(),
NumericT(2));
117 ublas_v2 = ublas::scalar_vector<NumericT>(ublas_v2.size(),
NumericT(3));
123 std::cout <<
"Rank 1 update" << std::endl;
127 if (
diff(ublas_m1, vcl_m1) != 0 )
129 std::cout <<
"# Error at operation: rank 1 update" << std::endl;
130 std::cout <<
" diff: " <<
diff(ublas_m1, vcl_m1) << std::endl;
137 std::cout <<
"Scaled rank 1 update - CPU Scalar" << std::endl;
141 if (
diff(ublas_m1, vcl_m1) != 0 )
143 std::cout <<
"# Error at operation: scaled rank 1 update - CPU Scalar" << std::endl;
144 std::cout <<
" diff: " <<
diff(ublas_m1, vcl_m1) << std::endl;
149 std::cout <<
"Scaled rank 1 update - GPU Scalar" << std::endl;
153 if (
diff(ublas_m1, vcl_m1) != 0 )
155 std::cout <<
"# Error at operation: scaled rank 1 update - GPU Scalar" << std::endl;
156 std::cout <<
" diff: " <<
diff(ublas_m1, vcl_m1) << std::endl;
164 std::cout <<
"Matrix-Vector product" << std::endl;
168 if (
diff(ublas_v1, vcl_v1) != 0 )
170 std::cout <<
"# Error at operation: matrix-vector product" << std::endl;
171 std::cout <<
" diff: " <<
diff(ublas_v1, vcl_v1) << std::endl;
172 retval = EXIT_FAILURE;
175 std::cout <<
"Matrix-Vector product with scaled add" << std::endl;
184 if (
diff(ublas_v1, vcl_v1) != 0 )
186 std::cout <<
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
187 std::cout <<
" diff: " <<
diff(ublas_v1, vcl_v1) << std::endl;
188 retval = EXIT_FAILURE;
195 std::cout <<
"Transposed Matrix-Vector product" << std::endl;
199 if (
diff(ublas_v2, vcl_v2) != 0 )
201 std::cout <<
"# Error at operation: transposed matrix-vector product" << std::endl;
202 std::cout <<
" diff: " <<
diff(ublas_v2, vcl_v2) << std::endl;
203 retval = EXIT_FAILURE;
206 std::cout <<
"Transposed Matrix-Vector product with scaled add" << std::endl;
210 if (
diff(ublas_v2, vcl_v2) != 0 )
212 std::cout <<
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
213 std::cout <<
" diff: " <<
diff(ublas_v2, vcl_v2) << std::endl;
214 retval = EXIT_FAILURE;
219 std::cout <<
"Row sum with matrix" << std::endl;
220 ublas_v1 =
ublas::prod(ublas_m1, ublas::scalar_vector<NumericT>(ublas_m1.size2(),
NumericT(1)));
223 if (
diff(ublas_v1, vcl_v1) != 0 )
225 std::cout <<
"# Error at operation: row sum" << std::endl;
226 std::cout <<
" diff: " <<
diff(ublas_v1, vcl_v1) << std::endl;
227 retval = EXIT_FAILURE;
231 std::cout <<
"Row sum with matrix expression" << std::endl;
232 ublas_v1 =
ublas::prod(ublas_m1 + ublas_m1, ublas::scalar_vector<NumericT>(ublas_m1.size2(),
NumericT(1)));
235 if (
diff(ublas_v1, vcl_v1) != 0 )
237 std::cout <<
"# Error at operation: row sum (with expression)" << std::endl;
238 std::cout <<
" diff: " <<
diff(ublas_v1, vcl_v1) << std::endl;
239 retval = EXIT_FAILURE;
243 std::cout <<
"Column sum with matrix" << std::endl;
247 if (
diff(ublas_v2, vcl_v2) != 0 )
249 std::cout <<
"# Error at operation: column sum" << std::endl;
250 std::cout <<
" diff: " <<
diff(ublas_v2, vcl_v2) << std::endl;
251 retval = EXIT_FAILURE;
255 std::cout <<
"Column sum with matrix expression" << std::endl;
259 if (
diff(ublas_v2, vcl_v2) != 0 )
261 std::cout <<
"# Error at operation: column sum (with expression)" << std::endl;
262 std::cout <<
" diff: " <<
diff(ublas_v2, vcl_v2) << std::endl;
263 retval = EXIT_FAILURE;
274 template<
typename NumericT,
typename F>
277 int retval = EXIT_SUCCESS;
279 std::size_t num_rows = 141;
280 std::size_t num_cols = 103;
283 ublas::vector<NumericT> ublas_v1(num_rows);
284 for (std::size_t i = 0; i < ublas_v1.size(); ++i)
286 ublas::vector<NumericT> ublas_v2 = ublas::scalar_vector<NumericT>(num_cols,
NumericT(3));
289 ublas::matrix<NumericT> ublas_m1(ublas_v1.size(), ublas_v2.size());
290 ublas::matrix<NumericT> ublas_m2(ublas_v1.size(), ublas_v1.size());
293 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
294 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
298 for (std::size_t i = 0; i < ublas_m2.size1(); ++i)
299 for (std::size_t j = 0; j < ublas_m2.size2(); ++j)
300 ublas_m2(i,j) =
NumericT(j - i*j + i);
335 std::cout <<
"------------ Testing rank-1-updates and matrix-vector products ------------------" << std::endl;
337 std::cout <<
"* m = full, v1 = full, v2 = full" << std::endl;
338 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
339 vcl_m1_native, vcl_v1_native, vcl_v2_native);
340 if (retval == EXIT_FAILURE)
342 std::cout <<
" --- FAILED! ---" << std::endl;
346 std::cout <<
" --- PASSED ---" << std::endl;
348 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
349 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
352 std::cout <<
"* m = full, v1 = full, v2 = range" << std::endl;
353 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
354 vcl_m1_native, vcl_v1_native, vcl_v2_range);
355 if (retval == EXIT_FAILURE)
357 std::cout <<
" --- FAILED! ---" << std::endl;
361 std::cout <<
" --- PASSED ---" << std::endl;
364 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
365 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
368 std::cout <<
"* m = full, v1 = full, v2 = slice" << std::endl;
369 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
370 vcl_m1_native, vcl_v1_native, vcl_v2_slice);
371 if (retval == EXIT_FAILURE)
373 std::cout <<
" --- FAILED! ---" << std::endl;
377 std::cout <<
" --- PASSED ---" << std::endl;
380 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
381 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
387 std::cout <<
"* m = full, v1 = range, v2 = full" << std::endl;
388 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
389 vcl_m1_native, vcl_v1_range, vcl_v2_native);
390 if (retval == EXIT_FAILURE)
392 std::cout <<
" --- FAILED! ---" << std::endl;
396 std::cout <<
" --- PASSED ---" << std::endl;
399 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
400 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
403 std::cout <<
"* m = full, v1 = range, v2 = range" << std::endl;
404 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
405 vcl_m1_native, vcl_v1_range, vcl_v2_range);
406 if (retval == EXIT_FAILURE)
408 std::cout <<
" --- FAILED! ---" << std::endl;
412 std::cout <<
" --- PASSED ---" << std::endl;
415 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
416 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
419 std::cout <<
"* m = full, v1 = range, v2 = slice" << std::endl;
420 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
421 vcl_m1_native, vcl_v1_range, vcl_v2_slice);
422 if (retval == EXIT_FAILURE)
424 std::cout <<
" --- FAILED! ---" << std::endl;
428 std::cout <<
" --- PASSED ---" << std::endl;
431 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
432 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
438 std::cout <<
"* m = full, v1 = slice, v2 = full" << std::endl;
439 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
440 vcl_m1_native, vcl_v1_slice, vcl_v2_native);
441 if (retval == EXIT_FAILURE)
443 std::cout <<
" --- FAILED! ---" << std::endl;
447 std::cout <<
" --- PASSED ---" << std::endl;
450 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
451 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
454 std::cout <<
"* m = full, v1 = slice, v2 = range" << std::endl;
455 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
456 vcl_m1_native, vcl_v1_slice, vcl_v2_range);
457 if (retval == EXIT_FAILURE)
459 std::cout <<
" --- FAILED! ---" << std::endl;
463 std::cout <<
" --- PASSED ---" << std::endl;
466 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
467 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
470 std::cout <<
"* m = full, v1 = slice, v2 = slice" << std::endl;
471 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
472 vcl_m1_native, vcl_v1_slice, vcl_v2_slice);
473 if (retval == EXIT_FAILURE)
475 std::cout <<
" --- FAILED! ---" << std::endl;
479 std::cout <<
" --- PASSED ---" << std::endl;
482 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
483 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
488 std::cout <<
"* m = range, v1 = full, v2 = full" << std::endl;
489 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
490 vcl_m1_range, vcl_v1_native, vcl_v2_native);
491 if (retval == EXIT_FAILURE)
493 std::cout <<
" --- FAILED! ---" << std::endl;
497 std::cout <<
" --- PASSED ---" << std::endl;
500 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
501 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
504 std::cout <<
"* m = range, v1 = full, v2 = range" << std::endl;
505 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
506 vcl_m1_range, vcl_v1_native, vcl_v2_range);
507 if (retval == EXIT_FAILURE)
509 std::cout <<
" --- FAILED! ---" << std::endl;
513 std::cout <<
" --- PASSED ---" << std::endl;
516 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
517 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
520 std::cout <<
"* m = range, v1 = full, v2 = slice" << std::endl;
521 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
522 vcl_m1_range, vcl_v1_native, vcl_v2_slice);
523 if (retval == EXIT_FAILURE)
525 std::cout <<
" --- FAILED! ---" << std::endl;
529 std::cout <<
" --- PASSED ---" << std::endl;
532 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
533 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
539 std::cout <<
"* m = range, v1 = range, v2 = full" << std::endl;
540 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
541 vcl_m1_range, vcl_v1_range, vcl_v2_native);
542 if (retval == EXIT_FAILURE)
544 std::cout <<
" --- FAILED! ---" << std::endl;
548 std::cout <<
" --- PASSED ---" << std::endl;
551 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
552 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
555 std::cout <<
"* m = range, v1 = range, v2 = range" << std::endl;
556 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
557 vcl_m1_range, vcl_v1_range, vcl_v2_range);
558 if (retval == EXIT_FAILURE)
560 std::cout <<
" --- FAILED! ---" << std::endl;
564 std::cout <<
" --- PASSED ---" << std::endl;
567 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
568 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
571 std::cout <<
"* m = range, v1 = range, v2 = slice" << std::endl;
572 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
573 vcl_m1_range, vcl_v1_range, vcl_v2_slice);
574 if (retval == EXIT_FAILURE)
576 std::cout <<
" --- FAILED! ---" << std::endl;
580 std::cout <<
" --- PASSED ---" << std::endl;
583 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
584 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
590 std::cout <<
"* m = range, v1 = slice, v2 = full" << std::endl;
591 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
592 vcl_m1_range, vcl_v1_slice, vcl_v2_native);
593 if (retval == EXIT_FAILURE)
595 std::cout <<
" --- FAILED! ---" << std::endl;
599 std::cout <<
" --- PASSED ---" << std::endl;
602 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
603 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
606 std::cout <<
"* m = range, v1 = slice, v2 = range" << std::endl;
607 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
608 vcl_m1_range, vcl_v1_slice, vcl_v2_range);
609 if (retval == EXIT_FAILURE)
611 std::cout <<
" --- FAILED! ---" << std::endl;
615 std::cout <<
" --- PASSED ---" << std::endl;
618 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
619 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
622 std::cout <<
"* m = range, v1 = slice, v2 = slice" << std::endl;
623 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
624 vcl_m1_range, vcl_v1_slice, vcl_v2_slice);
625 if (retval == EXIT_FAILURE)
627 std::cout <<
" --- FAILED! ---" << std::endl;
631 std::cout <<
" --- PASSED ---" << std::endl;
634 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
635 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
640 std::cout <<
"* m = slice, v1 = full, v2 = full" << std::endl;
641 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
642 vcl_m1_slice, vcl_v1_native, vcl_v2_native);
643 if (retval == EXIT_FAILURE)
645 std::cout <<
" --- FAILED! ---" << std::endl;
649 std::cout <<
" --- PASSED ---" << std::endl;
652 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
653 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
656 std::cout <<
"* m = slice, v1 = full, v2 = range" << std::endl;
657 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
658 vcl_m1_slice, vcl_v1_native, vcl_v2_range);
659 if (retval == EXIT_FAILURE)
661 std::cout <<
" --- FAILED! ---" << std::endl;
665 std::cout <<
" --- PASSED ---" << std::endl;
668 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
669 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
672 std::cout <<
"* m = slice, v1 = full, v2 = slice" << std::endl;
673 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
674 vcl_m1_slice, vcl_v1_native, vcl_v2_slice);
675 if (retval == EXIT_FAILURE)
677 std::cout <<
" --- FAILED! ---" << std::endl;
681 std::cout <<
" --- PASSED ---" << std::endl;
684 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
685 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
691 std::cout <<
"* m = slice, v1 = range, v2 = full" << std::endl;
692 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
693 vcl_m1_slice, vcl_v1_range, vcl_v2_native);
694 if (retval == EXIT_FAILURE)
696 std::cout <<
" --- FAILED! ---" << std::endl;
700 std::cout <<
" --- PASSED ---" << std::endl;
703 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
704 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
707 std::cout <<
"* m = slice, v1 = range, v2 = range" << std::endl;
708 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
709 vcl_m1_slice, vcl_v1_range, vcl_v2_range);
710 if (retval == EXIT_FAILURE)
712 std::cout <<
" --- FAILED! ---" << std::endl;
716 std::cout <<
" --- PASSED ---" << std::endl;
719 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
720 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
723 std::cout <<
"* m = slice, v1 = range, v2 = slice" << std::endl;
724 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
725 vcl_m1_slice, vcl_v1_range, vcl_v2_slice);
726 if (retval == EXIT_FAILURE)
728 std::cout <<
" --- FAILED! ---" << std::endl;
732 std::cout <<
" --- PASSED ---" << std::endl;
736 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
737 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
742 std::cout <<
"* m = slice, v1 = slice, v2 = full" << std::endl;
743 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
744 vcl_m1_slice, vcl_v1_slice, vcl_v2_native);
745 if (retval == EXIT_FAILURE)
747 std::cout <<
" --- FAILED! ---" << std::endl;
751 std::cout <<
" --- PASSED ---" << std::endl;
753 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
754 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
758 std::cout <<
"* m = slice, v1 = slice, v2 = range" << std::endl;
759 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
760 vcl_m1_slice, vcl_v1_slice, vcl_v2_range);
761 if (retval == EXIT_FAILURE)
763 std::cout <<
" --- FAILED! ---" << std::endl;
767 std::cout <<
" --- PASSED ---" << std::endl;
770 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
771 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
774 std::cout <<
"* m = slice, v1 = slice, v2 = slice" << std::endl;
775 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
776 vcl_m1_slice, vcl_v1_slice, vcl_v2_slice);
777 if (retval == EXIT_FAILURE)
779 std::cout <<
" --- FAILED! ---" << std::endl;
783 std::cout <<
" --- PASSED ---" << std::endl;
793 std::cout << std::endl;
794 std::cout <<
"----------------------------------------------" << std::endl;
795 std::cout <<
"----------------------------------------------" << std::endl;
796 std::cout <<
"## Test :: Matrix" << std::endl;
797 std::cout <<
"----------------------------------------------" << std::endl;
798 std::cout <<
"----------------------------------------------" << std::endl;
799 std::cout << std::endl;
801 int retval = EXIT_SUCCESS;
803 std::cout << std::endl;
804 std::cout <<
"----------------------------------------------" << std::endl;
805 std::cout << std::endl;
808 std::cout <<
"# Testing setup:" << std::endl;
809 std::cout <<
" numeric: int" << std::endl;
810 std::cout <<
" layout: row-major" << std::endl;
811 retval = test<NumericT, viennacl::row_major>();
812 if ( retval == EXIT_SUCCESS )
813 std::cout <<
"# Test passed" << std::endl;
817 std::cout << std::endl;
818 std::cout <<
"----------------------------------------------" << std::endl;
819 std::cout << std::endl;
822 std::cout <<
"# Testing setup:" << std::endl;
823 std::cout <<
" numeric: int" << std::endl;
824 std::cout <<
" layout: column-major" << std::endl;
825 retval = test<NumericT, viennacl::column_major>();
826 if ( retval == EXIT_SUCCESS )
827 std::cout <<
"# Test passed" << std::endl;
831 std::cout << std::endl;
832 std::cout <<
"----------------------------------------------" << std::endl;
833 std::cout << std::endl;
836 #ifdef VIENNACL_WITH_OPENCL
842 std::cout <<
"# Testing setup:" << std::endl;
843 std::cout <<
" numeric: double" << std::endl;
844 std::cout <<
" layout: row-major" << std::endl;
845 retval = test<NumericT, viennacl::row_major>();
846 if ( retval == EXIT_SUCCESS )
847 std::cout <<
"# Test passed" << std::endl;
851 std::cout << std::endl;
852 std::cout <<
"----------------------------------------------" << std::endl;
853 std::cout << std::endl;
856 std::cout <<
"# Testing setup:" << std::endl;
857 std::cout <<
" numeric: double" << std::endl;
858 std::cout <<
" layout: column-major" << std::endl;
859 retval = test<NumericT, viennacl::column_major>();
860 if ( retval == EXIT_SUCCESS )
861 std::cout <<
"# Test passed" << std::endl;
865 std::cout << std::endl;
866 std::cout <<
"----------------------------------------------" << std::endl;
867 std::cout << std::endl;
870 std::cout << std::endl;
871 std::cout <<
"------- Test completed --------" << std::endl;
872 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...
int test_prod_rank1(UblasMatrixType &ublas_m1, UblasVectorType &ublas_v1, UblasVectorType &ublas_v2, VCLMatrixType &vcl_m1, VCLVectorType1 &vcl_v1, VCLVectorType2 &vcl_v2)
Class for representing strided submatrices of a bigger matrix A.
void trans(matrix_expression< const matrix_base< NumericT, SizeT, DistanceT >, const matrix_base< NumericT, SizeT, DistanceT >, op_trans > const &proxy, matrix_base< NumericT > &temp_trans)
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class.
viennacl::vector_expression< const viennacl::matrix_base< NumericT >, const viennacl::matrix_base< NumericT >, viennacl::op_row_sum > row_sum(viennacl::matrix_base< NumericT > const &A)
User interface function for computing the sum of all elements of each row of a matrix.
void finish()
Synchronizes the execution. finish() will only return after all compute kernels (CUDA, OpenCL) have completed.
viennacl::scalar< int > s2
viennacl::scalar< float > s1
viennacl::ocl::device const & current_device()
Convenience function for returning the active device in the current context.
viennacl::vector< float > v1
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
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.
ScalarType diff(ScalarType &s1, viennacl::scalar< ScalarType > &s2)
Implementations of LU factorization for row-major and column-major dense matrices.
Implementations of dense direct solvers are found here.
viennacl::matrix_expression< const vector_base< NumericT >, const vector_base< NumericT >, op_prod > outer_prod(const vector_base< NumericT > &vec1, const vector_base< NumericT > &vec2)
Returns a proxy class for the operation mat += vec1 * vec2^T, i.e. a rank 1 update.
Stub routines for the summation of elements in a vector, or all elements in either a row or column of...
viennacl::vector< int > v2
void prod(std::vector< std::map< IndexT, NumericT > > const &stl_A, std::vector< std::map< IndexT, NumericT > > const &stl_B, std::vector< std::map< IndexT, NumericT > > &stl_C)
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) ...
A range class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Class for representing non-strided submatrices of a bigger matrix A.
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
viennacl::vector_expression< const viennacl::matrix_base< NumericT >, const viennacl::matrix_base< NumericT >, viennacl::op_col_sum > column_sum(viennacl::matrix_base< NumericT > const &A)
User interface function for computing the sum of all elements of each column of a matrix...
Implementation of the ViennaCL scalar class.