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))
107 template<
typename NumericT,
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;
176 NumericT alpha =
static_cast<NumericT
>(2);
177 NumericT beta =
static_cast<NumericT
>(3);
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;
225 template<
typename NumericT,
typename F>
228 int retval = EXIT_SUCCESS;
230 std::size_t num_rows = 141;
231 std::size_t num_cols = 103;
234 ublas::vector<NumericT> ublas_v1(num_rows);
235 for (std::size_t i = 0; i < ublas_v1.size(); ++i)
236 ublas_v1(i) = NumericT(i);
237 ublas::vector<NumericT> ublas_v2 = ublas::scalar_vector<NumericT>(num_cols, NumericT(3));
240 ublas::matrix<NumericT> ublas_m1(ublas_v1.size(), ublas_v2.size());
241 ublas::matrix<NumericT> ublas_m2(ublas_v1.size(), ublas_v1.size());
244 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
245 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
246 ublas_m1(i,j) = NumericT(i+j);
249 for (std::size_t i = 0; i < ublas_m2.size1(); ++i)
250 for (std::size_t j = 0; j < ublas_m2.size2(); ++j)
251 ublas_m2(i,j) = NumericT(j - i*j + i);
286 std::cout <<
"------------ Testing rank-1-updates and matrix-vector products ------------------" << std::endl;
288 std::cout <<
"* m = full, v1 = full, v2 = full" << std::endl;
289 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
290 vcl_m1_native, vcl_v1_native, vcl_v2_native);
291 if (retval == EXIT_FAILURE)
293 std::cout <<
" --- FAILED! ---" << std::endl;
297 std::cout <<
" --- PASSED ---" << std::endl;
299 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
300 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
301 ublas_m1(i,j) = NumericT(i+j);
303 std::cout <<
"* m = full, v1 = full, v2 = range" << std::endl;
304 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
305 vcl_m1_native, vcl_v1_native, vcl_v2_range);
306 if (retval == EXIT_FAILURE)
308 std::cout <<
" --- FAILED! ---" << std::endl;
312 std::cout <<
" --- PASSED ---" << std::endl;
315 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
316 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
317 ublas_m1(i,j) = NumericT(i+j);
319 std::cout <<
"* m = full, v1 = full, v2 = slice" << std::endl;
320 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
321 vcl_m1_native, vcl_v1_native, vcl_v2_slice);
322 if (retval == EXIT_FAILURE)
324 std::cout <<
" --- FAILED! ---" << std::endl;
328 std::cout <<
" --- PASSED ---" << std::endl;
331 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
332 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
333 ublas_m1(i,j) = NumericT(i+j);
338 std::cout <<
"* m = full, v1 = range, v2 = full" << std::endl;
339 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
340 vcl_m1_native, vcl_v1_range, vcl_v2_native);
341 if (retval == EXIT_FAILURE)
343 std::cout <<
" --- FAILED! ---" << std::endl;
347 std::cout <<
" --- PASSED ---" << std::endl;
350 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
351 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
352 ublas_m1(i,j) = NumericT(i+j);
354 std::cout <<
"* m = full, v1 = range, v2 = range" << std::endl;
355 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
356 vcl_m1_native, vcl_v1_range, vcl_v2_range);
357 if (retval == EXIT_FAILURE)
359 std::cout <<
" --- FAILED! ---" << std::endl;
363 std::cout <<
" --- PASSED ---" << std::endl;
366 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
367 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
368 ublas_m1(i,j) = NumericT(i+j);
370 std::cout <<
"* m = full, v1 = range, v2 = slice" << std::endl;
371 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
372 vcl_m1_native, vcl_v1_range, vcl_v2_slice);
373 if (retval == EXIT_FAILURE)
375 std::cout <<
" --- FAILED! ---" << std::endl;
379 std::cout <<
" --- PASSED ---" << std::endl;
382 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
383 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
384 ublas_m1(i,j) = NumericT(i+j);
389 std::cout <<
"* m = full, v1 = slice, v2 = full" << std::endl;
390 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
391 vcl_m1_native, vcl_v1_slice, vcl_v2_native);
392 if (retval == EXIT_FAILURE)
394 std::cout <<
" --- FAILED! ---" << std::endl;
398 std::cout <<
" --- PASSED ---" << std::endl;
401 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
402 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
403 ublas_m1(i,j) = NumericT(i+j);
405 std::cout <<
"* m = full, v1 = slice, v2 = range" << std::endl;
406 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
407 vcl_m1_native, vcl_v1_slice, vcl_v2_range);
408 if (retval == EXIT_FAILURE)
410 std::cout <<
" --- FAILED! ---" << std::endl;
414 std::cout <<
" --- PASSED ---" << std::endl;
417 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
418 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
419 ublas_m1(i,j) = NumericT(i+j);
421 std::cout <<
"* m = full, v1 = slice, v2 = slice" << std::endl;
422 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
423 vcl_m1_native, vcl_v1_slice, vcl_v2_slice);
424 if (retval == EXIT_FAILURE)
426 std::cout <<
" --- FAILED! ---" << std::endl;
430 std::cout <<
" --- PASSED ---" << std::endl;
433 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
434 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
435 ublas_m1(i,j) = NumericT(i+j);
439 std::cout <<
"* m = range, v1 = full, v2 = full" << std::endl;
440 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
441 vcl_m1_range, vcl_v1_native, vcl_v2_native);
442 if (retval == EXIT_FAILURE)
444 std::cout <<
" --- FAILED! ---" << std::endl;
448 std::cout <<
" --- PASSED ---" << std::endl;
451 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
452 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
453 ublas_m1(i,j) = NumericT(i+j);
455 std::cout <<
"* m = range, v1 = full, v2 = range" << std::endl;
456 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
457 vcl_m1_range, vcl_v1_native, vcl_v2_range);
458 if (retval == EXIT_FAILURE)
460 std::cout <<
" --- FAILED! ---" << std::endl;
464 std::cout <<
" --- PASSED ---" << std::endl;
467 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
468 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
469 ublas_m1(i,j) = NumericT(i+j);
471 std::cout <<
"* m = range, v1 = full, v2 = slice" << std::endl;
472 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
473 vcl_m1_range, vcl_v1_native, vcl_v2_slice);
474 if (retval == EXIT_FAILURE)
476 std::cout <<
" --- FAILED! ---" << std::endl;
480 std::cout <<
" --- PASSED ---" << std::endl;
483 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
484 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
485 ublas_m1(i,j) = NumericT(i+j);
490 std::cout <<
"* m = range, v1 = range, v2 = full" << std::endl;
491 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
492 vcl_m1_range, vcl_v1_range, vcl_v2_native);
493 if (retval == EXIT_FAILURE)
495 std::cout <<
" --- FAILED! ---" << std::endl;
499 std::cout <<
" --- PASSED ---" << std::endl;
502 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
503 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
504 ublas_m1(i,j) = NumericT(i+j);
506 std::cout <<
"* m = range, v1 = range, v2 = range" << std::endl;
507 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
508 vcl_m1_range, vcl_v1_range, vcl_v2_range);
509 if (retval == EXIT_FAILURE)
511 std::cout <<
" --- FAILED! ---" << std::endl;
515 std::cout <<
" --- PASSED ---" << std::endl;
518 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
519 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
520 ublas_m1(i,j) = NumericT(i+j);
522 std::cout <<
"* m = range, v1 = range, v2 = slice" << std::endl;
523 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
524 vcl_m1_range, vcl_v1_range, vcl_v2_slice);
525 if (retval == EXIT_FAILURE)
527 std::cout <<
" --- FAILED! ---" << std::endl;
531 std::cout <<
" --- PASSED ---" << std::endl;
534 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
535 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
536 ublas_m1(i,j) = NumericT(i+j);
541 std::cout <<
"* m = range, v1 = slice, v2 = full" << std::endl;
542 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
543 vcl_m1_range, vcl_v1_slice, vcl_v2_native);
544 if (retval == EXIT_FAILURE)
546 std::cout <<
" --- FAILED! ---" << std::endl;
550 std::cout <<
" --- PASSED ---" << std::endl;
553 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
554 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
555 ublas_m1(i,j) = NumericT(i+j);
557 std::cout <<
"* m = range, v1 = slice, v2 = range" << std::endl;
558 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
559 vcl_m1_range, vcl_v1_slice, vcl_v2_range);
560 if (retval == EXIT_FAILURE)
562 std::cout <<
" --- FAILED! ---" << std::endl;
566 std::cout <<
" --- PASSED ---" << std::endl;
569 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
570 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
571 ublas_m1(i,j) = NumericT(i+j);
573 std::cout <<
"* m = range, v1 = slice, v2 = slice" << std::endl;
574 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
575 vcl_m1_range, vcl_v1_slice, vcl_v2_slice);
576 if (retval == EXIT_FAILURE)
578 std::cout <<
" --- FAILED! ---" << std::endl;
582 std::cout <<
" --- PASSED ---" << std::endl;
585 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
586 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
587 ublas_m1(i,j) = NumericT(i+j);
591 std::cout <<
"* m = slice, v1 = full, v2 = full" << std::endl;
592 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
593 vcl_m1_slice, vcl_v1_native, vcl_v2_native);
594 if (retval == EXIT_FAILURE)
596 std::cout <<
" --- FAILED! ---" << std::endl;
600 std::cout <<
" --- PASSED ---" << std::endl;
603 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
604 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
605 ublas_m1(i,j) = NumericT(i+j);
607 std::cout <<
"* m = slice, v1 = full, v2 = range" << std::endl;
608 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
609 vcl_m1_slice, vcl_v1_native, vcl_v2_range);
610 if (retval == EXIT_FAILURE)
612 std::cout <<
" --- FAILED! ---" << std::endl;
616 std::cout <<
" --- PASSED ---" << std::endl;
619 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
620 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
621 ublas_m1(i,j) = NumericT(i+j);
623 std::cout <<
"* m = slice, v1 = full, v2 = slice" << std::endl;
624 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
625 vcl_m1_slice, vcl_v1_native, vcl_v2_slice);
626 if (retval == EXIT_FAILURE)
628 std::cout <<
" --- FAILED! ---" << std::endl;
632 std::cout <<
" --- PASSED ---" << std::endl;
635 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
636 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
637 ublas_m1(i,j) = NumericT(i+j);
642 std::cout <<
"* m = slice, v1 = range, v2 = full" << std::endl;
643 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
644 vcl_m1_slice, vcl_v1_range, vcl_v2_native);
645 if (retval == EXIT_FAILURE)
647 std::cout <<
" --- FAILED! ---" << std::endl;
651 std::cout <<
" --- PASSED ---" << std::endl;
654 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
655 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
656 ublas_m1(i,j) = NumericT(i+j);
658 std::cout <<
"* m = slice, v1 = range, v2 = range" << std::endl;
659 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
660 vcl_m1_slice, vcl_v1_range, vcl_v2_range);
661 if (retval == EXIT_FAILURE)
663 std::cout <<
" --- FAILED! ---" << std::endl;
667 std::cout <<
" --- PASSED ---" << std::endl;
670 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
671 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
672 ublas_m1(i,j) = NumericT(i+j);
674 std::cout <<
"* m = slice, v1 = range, v2 = slice" << std::endl;
675 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
676 vcl_m1_slice, vcl_v1_range, vcl_v2_slice);
677 if (retval == EXIT_FAILURE)
679 std::cout <<
" --- FAILED! ---" << std::endl;
683 std::cout <<
" --- PASSED ---" << std::endl;
687 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
688 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
689 ublas_m1(i,j) = NumericT(i+j);
693 std::cout <<
"* m = slice, v1 = slice, v2 = full" << std::endl;
694 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
695 vcl_m1_slice, vcl_v1_slice, vcl_v2_native);
696 if (retval == EXIT_FAILURE)
698 std::cout <<
" --- FAILED! ---" << std::endl;
702 std::cout <<
" --- PASSED ---" << std::endl;
704 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
705 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
706 ublas_m1(i,j) = NumericT(i+j);
709 std::cout <<
"* m = slice, v1 = slice, v2 = range" << std::endl;
710 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
711 vcl_m1_slice, vcl_v1_slice, vcl_v2_range);
712 if (retval == EXIT_FAILURE)
714 std::cout <<
" --- FAILED! ---" << std::endl;
718 std::cout <<
" --- PASSED ---" << std::endl;
721 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
722 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
723 ublas_m1(i,j) = NumericT(i+j);
725 std::cout <<
"* m = slice, v1 = slice, v2 = slice" << std::endl;
726 retval = test_prod_rank1<NumericT>(ublas_m1, ublas_v1, ublas_v2,
727 vcl_m1_slice, vcl_v1_slice, vcl_v2_slice);
728 if (retval == EXIT_FAILURE)
730 std::cout <<
" --- FAILED! ---" << std::endl;
734 std::cout <<
" --- PASSED ---" << std::endl;
744 std::cout << std::endl;
745 std::cout <<
"----------------------------------------------" << std::endl;
746 std::cout <<
"----------------------------------------------" << std::endl;
747 std::cout <<
"## Test :: Matrix" << std::endl;
748 std::cout <<
"----------------------------------------------" << std::endl;
749 std::cout <<
"----------------------------------------------" << std::endl;
750 std::cout << std::endl;
752 int retval = EXIT_SUCCESS;
754 std::cout << std::endl;
755 std::cout <<
"----------------------------------------------" << std::endl;
756 std::cout << std::endl;
758 typedef int NumericT;
759 std::cout <<
"# Testing setup:" << std::endl;
760 std::cout <<
" numeric: int" << std::endl;
761 std::cout <<
" layout: row-major" << std::endl;
762 retval = test<NumericT, viennacl::row_major>();
763 if ( retval == EXIT_SUCCESS )
764 std::cout <<
"# Test passed" << std::endl;
768 std::cout << std::endl;
769 std::cout <<
"----------------------------------------------" << std::endl;
770 std::cout << std::endl;
772 typedef int NumericT;
773 std::cout <<
"# Testing setup:" << std::endl;
774 std::cout <<
" numeric: int" << std::endl;
775 std::cout <<
" layout: column-major" << std::endl;
776 retval = test<NumericT, viennacl::column_major>();
777 if ( retval == EXIT_SUCCESS )
778 std::cout <<
"# Test passed" << std::endl;
782 std::cout << std::endl;
783 std::cout <<
"----------------------------------------------" << std::endl;
784 std::cout << std::endl;
787 #ifdef VIENNACL_WITH_OPENCL
792 typedef long NumericT;
793 std::cout <<
"# Testing setup:" << std::endl;
794 std::cout <<
" numeric: double" << std::endl;
795 std::cout <<
" layout: row-major" << std::endl;
796 retval = test<NumericT, viennacl::row_major>();
797 if ( retval == EXIT_SUCCESS )
798 std::cout <<
"# Test passed" << std::endl;
802 std::cout << std::endl;
803 std::cout <<
"----------------------------------------------" << std::endl;
804 std::cout << std::endl;
806 typedef long NumericT;
807 std::cout <<
"# Testing setup:" << std::endl;
808 std::cout <<
" numeric: double" << std::endl;
809 std::cout <<
" layout: column-major" << std::endl;
810 retval = test<NumericT, viennacl::column_major>();
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;
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.
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.
viennacl::vector< int > v2
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.
Implementation of the ViennaCL scalar class.