45 template<
typename ScalarType>
54 template<
typename ScalarType,
typename VCLVectorType>
57 std::vector<ScalarType> v2_cpu(v2.size());
61 for (
unsigned int i=0;i<v1.size(); ++i)
63 if (v2_cpu[i] != v1[i])
70 template<
typename NumericT,
typename VCLMatrixType>
71 NumericT diff(std::vector<std::vector<NumericT> >
const & mat1, VCLMatrixType
const & mat2)
73 std::vector<std::vector<NumericT> > mat2_cpu(mat2.size1(), std::vector<NumericT>(mat2.size2()));
77 for (
unsigned int i = 0; i < mat2_cpu.size(); ++i)
79 for (
unsigned int j = 0; j < mat2_cpu[i].size(); ++j)
81 if (mat2_cpu[i][j] != mat1[i][j])
93 typename STLMatrixType,
typename STLVectorType,
94 typename VCLMatrixType,
typename VCLVectorType1,
typename VCLVectorType2>
95 int test_prod_rank1(STLMatrixType & std_m1, STLVectorType & std_v1, STLVectorType & std_v2,
96 VCLMatrixType & vcl_m1, VCLVectorType1 & vcl_v1, VCLVectorType2 & vcl_v2)
98 int retval = EXIT_SUCCESS;
101 std_v1 = std::vector<NumericT>(std_v1.size(),
NumericT(2));
102 std_v2 = std::vector<NumericT>(std_v2.size(),
NumericT(3));
108 std::cout <<
"Rank 1 update" << std::endl;
110 for (std::size_t i=0; i<std_m1.size(); ++i)
111 for (std::size_t j=0; j<std_m1[i].size(); ++j)
112 std_m1[i][j] += std_v1[i] * std_v2[j];
114 if (
diff(std_m1, vcl_m1) != 0 )
116 std::cout <<
"# Error at operation: rank 1 update" << std::endl;
117 std::cout <<
" diff: " <<
diff(std_m1, vcl_m1) << std::endl;
124 std::cout <<
"Scaled rank 1 update - CPU Scalar" << std::endl;
125 for (std::size_t i=0; i<std_m1.size(); ++i)
126 for (std::size_t j=0; j<std_m1[i].size(); ++j)
127 std_m1[i][j] +=
NumericT(4) * std_v1[i] * std_v2[j];
130 if (
diff(std_m1, vcl_m1) != 0 )
132 std::cout <<
"# Error at operation: scaled rank 1 update - CPU Scalar" << std::endl;
133 std::cout <<
" diff: " <<
diff(std_m1, vcl_m1) << std::endl;
138 std::cout <<
"Scaled rank 1 update - GPU Scalar" << std::endl;
139 for (std::size_t i=0; i<std_m1.size(); ++i)
140 for (std::size_t j=0; j<std_m1[i].size(); ++j)
141 std_m1[i][j] +=
NumericT(4) * std_v1[i] * std_v2[j];
144 if (
diff(std_m1, vcl_m1) != 0 )
146 std::cout <<
"# Error at operation: scaled rank 1 update - GPU Scalar" << std::endl;
147 std::cout <<
" diff: " <<
diff(std_m1, vcl_m1) << std::endl;
155 std::cout <<
"Matrix-Vector product" << std::endl;
156 for (std::size_t i=0; i<std_m1.size(); ++i)
159 for (std::size_t j=0; j<std_m1[i].size(); ++j)
160 temp += std_m1[i][j] * std_v2[j];
166 if (
diff(std_v1, vcl_v1) != 0 )
168 std::cout <<
"# Error at operation: matrix-vector product" << std::endl;
169 std::cout <<
" diff: " <<
diff(std_v1, vcl_v1) << std::endl;
170 retval = EXIT_FAILURE;
173 std::cout <<
"Matrix-Vector product with scaled add" << std::endl;
179 for (std::size_t i=0; i<std_m1.size(); ++i)
182 for (std::size_t j=0; j<std_m1[i].size(); ++j)
183 temp += std_m1[i][j] * std_v2[j];
184 std_v1[i] = alpha * temp + beta * std_v1[i];
188 if (
diff(std_v1, vcl_v1) != 0 )
190 std::cout <<
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
191 std::cout <<
" diff: " <<
diff(std_v1, vcl_v1) << std::endl;
192 retval = EXIT_FAILURE;
199 std::cout <<
"Transposed Matrix-Vector product" << std::endl;
200 for (std::size_t i=0; i<std_m1[0].size(); ++i)
203 for (std::size_t j=0; j<std_m1.size(); ++j)
204 temp += std_m1[j][i] * std_v1[j];
205 std_v2[i] = alpha * temp;
209 if (
diff(std_v2, vcl_v2) != 0 )
211 std::cout <<
"# Error at operation: transposed matrix-vector product" << std::endl;
212 std::cout <<
" diff: " <<
diff(std_v2, vcl_v2) << std::endl;
213 retval = EXIT_FAILURE;
216 std::cout <<
"Transposed Matrix-Vector product with scaled add" << std::endl;
217 for (std::size_t i=0; i<std_m1[0].size(); ++i)
220 for (std::size_t j=0; j<std_m1.size(); ++j)
221 temp += std_m1[j][i] * std_v1[j];
222 std_v2[i] = alpha * temp + beta * std_v2[i];
226 if (
diff(std_v2, vcl_v2) != 0 )
228 std::cout <<
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
229 std::cout <<
" diff: " <<
diff(std_v2, vcl_v2) << std::endl;
230 retval = EXIT_FAILURE;
235 std::cout <<
"Row sum with matrix" << std::endl;
236 for (std::size_t i=0; i<std_m1.size(); ++i)
239 for (std::size_t j=0; j<std_m1[i].size(); ++j)
240 temp += std_m1[i][j];
245 if (
diff(std_v1, vcl_v1) != 0 )
247 std::cout <<
"# Error at operation: row sum" << std::endl;
248 std::cout <<
" diff: " <<
diff(std_v1, vcl_v1) << std::endl;
249 retval = EXIT_FAILURE;
253 std::cout <<
"Row sum with matrix expression" << std::endl;
254 for (std::size_t i=0; i<std_m1.size(); ++i)
257 for (std::size_t j=0; j<std_m1[i].size(); ++j)
258 temp += std_m1[i][j] + std_m1[i][j];
263 if (
diff(std_v1, vcl_v1) != 0 )
265 std::cout <<
"# Error at operation: row sum (with expression)" << std::endl;
266 std::cout <<
" diff: " <<
diff(std_v1, vcl_v1) << std::endl;
267 retval = EXIT_FAILURE;
271 std::cout <<
"Column sum with matrix" << std::endl;
272 for (std::size_t i=0; i<std_m1[0].size(); ++i)
275 for (std::size_t j=0; j<std_m1.size(); ++j)
276 temp += std_m1[j][i];
281 if (
diff(std_v2, vcl_v2) != 0 )
283 std::cout <<
"# Error at operation: column sum" << std::endl;
284 std::cout <<
" diff: " <<
diff(std_v2, vcl_v2) << std::endl;
285 retval = EXIT_FAILURE;
289 std::cout <<
"Column sum with matrix expression" << std::endl;
290 for (std::size_t i=0; i<std_m1[0].size(); ++i)
293 for (std::size_t j=0; j<std_m1.size(); ++j)
294 temp += std_m1[j][i] + std_m1[j][i];
299 if (
diff(std_v2, vcl_v2) != 0 )
301 std::cout <<
"# Error at operation: column sum (with expression)" << std::endl;
302 std::cout <<
" diff: " <<
diff(std_v2, vcl_v2) << std::endl;
303 retval = EXIT_FAILURE;
314 template<
typename NumericT,
typename F>
317 int retval = EXIT_SUCCESS;
319 std::size_t num_rows = 141;
320 std::size_t num_cols = 103;
323 std::vector<NumericT> std_v1(num_rows);
324 for (std::size_t i = 0; i < std_v1.size(); ++i)
326 std::vector<NumericT> std_v2 = std::vector<NumericT>(num_cols,
NumericT(3));
329 std::vector<std::vector<NumericT> > std_m1(std_v1.size(), std::vector<NumericT>(std_v2.size()));
330 std::vector<std::vector<NumericT> > std_m2(std_v1.size(), std::vector<NumericT>(std_v1.size()));
333 for (std::size_t i = 0; i < std_m1.size(); ++i)
334 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
338 for (std::size_t i = 0; i < std_m2.size(); ++i)
339 for (std::size_t j = 0; j < std_m2[i].size(); ++j)
340 std_m2[i][j] =
NumericT(j - i*j + i);
366 std::cout <<
"------------ Testing rank-1-updates and matrix-vector products ------------------" << std::endl;
368 std::cout <<
"* m = full, v1 = full, v2 = full" << std::endl;
369 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
370 vcl_m1_native, vcl_v1_native, vcl_v2_native);
371 if (retval == EXIT_FAILURE)
373 std::cout <<
" --- FAILED! ---" << std::endl;
377 std::cout <<
" --- PASSED ---" << std::endl;
379 for (std::size_t i = 0; i < std_m1.size(); ++i)
380 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
383 std::cout <<
"* m = full, v1 = full, v2 = range" << std::endl;
384 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
385 vcl_m1_native, vcl_v1_native, vcl_v2_range);
386 if (retval == EXIT_FAILURE)
388 std::cout <<
" --- FAILED! ---" << std::endl;
392 std::cout <<
" --- PASSED ---" << std::endl;
395 for (std::size_t i = 0; i < std_m1.size(); ++i)
396 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
399 std::cout <<
"* m = full, v1 = full, v2 = slice" << std::endl;
400 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
401 vcl_m1_native, vcl_v1_native, vcl_v2_slice);
402 if (retval == EXIT_FAILURE)
404 std::cout <<
" --- FAILED! ---" << std::endl;
408 std::cout <<
" --- PASSED ---" << std::endl;
411 for (std::size_t i = 0; i < std_m1.size(); ++i)
412 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
418 std::cout <<
"* m = full, v1 = range, v2 = full" << std::endl;
419 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
420 vcl_m1_native, vcl_v1_range, vcl_v2_native);
421 if (retval == EXIT_FAILURE)
423 std::cout <<
" --- FAILED! ---" << std::endl;
427 std::cout <<
" --- PASSED ---" << std::endl;
430 for (std::size_t i = 0; i < std_m1.size(); ++i)
431 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
434 std::cout <<
"* m = full, v1 = range, v2 = range" << std::endl;
435 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
436 vcl_m1_native, vcl_v1_range, vcl_v2_range);
437 if (retval == EXIT_FAILURE)
439 std::cout <<
" --- FAILED! ---" << std::endl;
443 std::cout <<
" --- PASSED ---" << std::endl;
446 for (std::size_t i = 0; i < std_m1.size(); ++i)
447 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
450 std::cout <<
"* m = full, v1 = range, v2 = slice" << std::endl;
451 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
452 vcl_m1_native, vcl_v1_range, vcl_v2_slice);
453 if (retval == EXIT_FAILURE)
455 std::cout <<
" --- FAILED! ---" << std::endl;
459 std::cout <<
" --- PASSED ---" << std::endl;
462 for (std::size_t i = 0; i < std_m1.size(); ++i)
463 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
469 std::cout <<
"* m = full, v1 = slice, v2 = full" << std::endl;
470 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
471 vcl_m1_native, vcl_v1_slice, vcl_v2_native);
472 if (retval == EXIT_FAILURE)
474 std::cout <<
" --- FAILED! ---" << std::endl;
478 std::cout <<
" --- PASSED ---" << std::endl;
481 for (std::size_t i = 0; i < std_m1.size(); ++i)
482 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
485 std::cout <<
"* m = full, v1 = slice, v2 = range" << std::endl;
486 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
487 vcl_m1_native, vcl_v1_slice, vcl_v2_range);
488 if (retval == EXIT_FAILURE)
490 std::cout <<
" --- FAILED! ---" << std::endl;
494 std::cout <<
" --- PASSED ---" << std::endl;
497 for (std::size_t i = 0; i < std_m1.size(); ++i)
498 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
501 std::cout <<
"* m = full, v1 = slice, v2 = slice" << std::endl;
502 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
503 vcl_m1_native, vcl_v1_slice, vcl_v2_slice);
504 if (retval == EXIT_FAILURE)
506 std::cout <<
" --- FAILED! ---" << std::endl;
510 std::cout <<
" --- PASSED ---" << std::endl;
513 for (std::size_t i = 0; i < std_m1.size(); ++i)
514 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
519 std::cout <<
"* m = range, v1 = full, v2 = full" << std::endl;
520 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
521 vcl_m1_range, vcl_v1_native, vcl_v2_native);
522 if (retval == EXIT_FAILURE)
524 std::cout <<
" --- FAILED! ---" << std::endl;
528 std::cout <<
" --- PASSED ---" << std::endl;
531 for (std::size_t i = 0; i < std_m1.size(); ++i)
532 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
535 std::cout <<
"* m = range, v1 = full, v2 = range" << std::endl;
536 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
537 vcl_m1_range, vcl_v1_native, vcl_v2_range);
538 if (retval == EXIT_FAILURE)
540 std::cout <<
" --- FAILED! ---" << std::endl;
544 std::cout <<
" --- PASSED ---" << std::endl;
547 for (std::size_t i = 0; i < std_m1.size(); ++i)
548 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
551 std::cout <<
"* m = range, v1 = full, v2 = slice" << std::endl;
552 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
553 vcl_m1_range, vcl_v1_native, vcl_v2_slice);
554 if (retval == EXIT_FAILURE)
556 std::cout <<
" --- FAILED! ---" << std::endl;
560 std::cout <<
" --- PASSED ---" << std::endl;
563 for (std::size_t i = 0; i < std_m1.size(); ++i)
564 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
570 std::cout <<
"* m = range, v1 = range, v2 = full" << std::endl;
571 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
572 vcl_m1_range, vcl_v1_range, vcl_v2_native);
573 if (retval == EXIT_FAILURE)
575 std::cout <<
" --- FAILED! ---" << std::endl;
579 std::cout <<
" --- PASSED ---" << std::endl;
582 for (std::size_t i = 0; i < std_m1.size(); ++i)
583 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
586 std::cout <<
"* m = range, v1 = range, v2 = range" << std::endl;
587 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
588 vcl_m1_range, vcl_v1_range, vcl_v2_range);
589 if (retval == EXIT_FAILURE)
591 std::cout <<
" --- FAILED! ---" << std::endl;
595 std::cout <<
" --- PASSED ---" << std::endl;
598 for (std::size_t i = 0; i < std_m1.size(); ++i)
599 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
602 std::cout <<
"* m = range, v1 = range, v2 = slice" << std::endl;
603 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
604 vcl_m1_range, vcl_v1_range, vcl_v2_slice);
605 if (retval == EXIT_FAILURE)
607 std::cout <<
" --- FAILED! ---" << std::endl;
611 std::cout <<
" --- PASSED ---" << std::endl;
614 for (std::size_t i = 0; i < std_m1.size(); ++i)
615 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
621 std::cout <<
"* m = range, v1 = slice, v2 = full" << std::endl;
622 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
623 vcl_m1_range, vcl_v1_slice, vcl_v2_native);
624 if (retval == EXIT_FAILURE)
626 std::cout <<
" --- FAILED! ---" << std::endl;
630 std::cout <<
" --- PASSED ---" << std::endl;
633 for (std::size_t i = 0; i < std_m1.size(); ++i)
634 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
637 std::cout <<
"* m = range, v1 = slice, v2 = range" << std::endl;
638 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
639 vcl_m1_range, vcl_v1_slice, vcl_v2_range);
640 if (retval == EXIT_FAILURE)
642 std::cout <<
" --- FAILED! ---" << std::endl;
646 std::cout <<
" --- PASSED ---" << std::endl;
649 for (std::size_t i = 0; i < std_m1.size(); ++i)
650 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
653 std::cout <<
"* m = range, v1 = slice, v2 = slice" << std::endl;
654 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
655 vcl_m1_range, vcl_v1_slice, vcl_v2_slice);
656 if (retval == EXIT_FAILURE)
658 std::cout <<
" --- FAILED! ---" << std::endl;
662 std::cout <<
" --- PASSED ---" << std::endl;
665 for (std::size_t i = 0; i < std_m1.size(); ++i)
666 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
671 std::cout <<
"* m = slice, v1 = full, v2 = full" << std::endl;
672 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
673 vcl_m1_slice, vcl_v1_native, vcl_v2_native);
674 if (retval == EXIT_FAILURE)
676 std::cout <<
" --- FAILED! ---" << std::endl;
680 std::cout <<
" --- PASSED ---" << std::endl;
683 for (std::size_t i = 0; i < std_m1.size(); ++i)
684 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
687 std::cout <<
"* m = slice, v1 = full, v2 = range" << std::endl;
688 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
689 vcl_m1_slice, vcl_v1_native, vcl_v2_range);
690 if (retval == EXIT_FAILURE)
692 std::cout <<
" --- FAILED! ---" << std::endl;
696 std::cout <<
" --- PASSED ---" << std::endl;
699 for (std::size_t i = 0; i < std_m1.size(); ++i)
700 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
703 std::cout <<
"* m = slice, v1 = full, v2 = slice" << std::endl;
704 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
705 vcl_m1_slice, vcl_v1_native, vcl_v2_slice);
706 if (retval == EXIT_FAILURE)
708 std::cout <<
" --- FAILED! ---" << std::endl;
712 std::cout <<
" --- PASSED ---" << std::endl;
715 for (std::size_t i = 0; i < std_m1.size(); ++i)
716 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
722 std::cout <<
"* m = slice, v1 = range, v2 = full" << std::endl;
723 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
724 vcl_m1_slice, vcl_v1_range, vcl_v2_native);
725 if (retval == EXIT_FAILURE)
727 std::cout <<
" --- FAILED! ---" << std::endl;
731 std::cout <<
" --- PASSED ---" << std::endl;
734 for (std::size_t i = 0; i < std_m1.size(); ++i)
735 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
738 std::cout <<
"* m = slice, v1 = range, v2 = range" << std::endl;
739 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
740 vcl_m1_slice, vcl_v1_range, vcl_v2_range);
741 if (retval == EXIT_FAILURE)
743 std::cout <<
" --- FAILED! ---" << std::endl;
747 std::cout <<
" --- PASSED ---" << std::endl;
750 for (std::size_t i = 0; i < std_m1.size(); ++i)
751 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
754 std::cout <<
"* m = slice, v1 = range, v2 = slice" << std::endl;
755 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
756 vcl_m1_slice, vcl_v1_range, vcl_v2_slice);
757 if (retval == EXIT_FAILURE)
759 std::cout <<
" --- FAILED! ---" << std::endl;
763 std::cout <<
" --- PASSED ---" << std::endl;
767 for (std::size_t i = 0; i < std_m1.size(); ++i)
768 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
773 std::cout <<
"* m = slice, v1 = slice, v2 = full" << std::endl;
774 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
775 vcl_m1_slice, vcl_v1_slice, vcl_v2_native);
776 if (retval == EXIT_FAILURE)
778 std::cout <<
" --- FAILED! ---" << std::endl;
782 std::cout <<
" --- PASSED ---" << std::endl;
784 for (std::size_t i = 0; i < std_m1.size(); ++i)
785 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
789 std::cout <<
"* m = slice, v1 = slice, v2 = range" << std::endl;
790 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
791 vcl_m1_slice, vcl_v1_slice, vcl_v2_range);
792 if (retval == EXIT_FAILURE)
794 std::cout <<
" --- FAILED! ---" << std::endl;
798 std::cout <<
" --- PASSED ---" << std::endl;
801 for (std::size_t i = 0; i < std_m1.size(); ++i)
802 for (std::size_t j = 0; j < std_m1[i].size(); ++j)
805 std::cout <<
"* m = slice, v1 = slice, v2 = slice" << std::endl;
806 retval = test_prod_rank1<NumericT>(std_m1, std_v1, std_v2,
807 vcl_m1_slice, vcl_v1_slice, vcl_v2_slice);
808 if (retval == EXIT_FAILURE)
810 std::cout <<
" --- FAILED! ---" << std::endl;
814 std::cout <<
" --- PASSED ---" << std::endl;
824 std::cout << std::endl;
825 std::cout <<
"----------------------------------------------" << std::endl;
826 std::cout <<
"----------------------------------------------" << std::endl;
827 std::cout <<
"## Test :: Matrix" << std::endl;
828 std::cout <<
"----------------------------------------------" << std::endl;
829 std::cout <<
"----------------------------------------------" << std::endl;
830 std::cout << std::endl;
832 int retval = EXIT_SUCCESS;
834 std::cout << std::endl;
835 std::cout <<
"----------------------------------------------" << std::endl;
836 std::cout << std::endl;
839 std::cout <<
"# Testing setup:" << std::endl;
840 std::cout <<
" numeric: int" << std::endl;
841 std::cout <<
" layout: row-major" << std::endl;
842 retval = test<NumericT, viennacl::row_major>();
843 if ( retval == EXIT_SUCCESS )
844 std::cout <<
"# Test passed" << std::endl;
848 std::cout << std::endl;
849 std::cout <<
"----------------------------------------------" << std::endl;
850 std::cout << std::endl;
853 std::cout <<
"# Testing setup:" << std::endl;
854 std::cout <<
" numeric: int" << std::endl;
855 std::cout <<
" layout: column-major" << std::endl;
856 retval = test<NumericT, viennacl::column_major>();
857 if ( retval == EXIT_SUCCESS )
858 std::cout <<
"# Test passed" << std::endl;
862 std::cout << std::endl;
863 std::cout <<
"----------------------------------------------" << std::endl;
864 std::cout << std::endl;
869 std::cout <<
"# Testing setup:" << std::endl;
870 std::cout <<
" numeric: long" << std::endl;
871 std::cout <<
" layout: row-major" << std::endl;
872 retval = test<NumericT, viennacl::row_major>();
873 if ( retval == EXIT_SUCCESS )
874 std::cout <<
"# Test passed" << std::endl;
878 std::cout << std::endl;
879 std::cout <<
"----------------------------------------------" << std::endl;
880 std::cout << std::endl;
883 std::cout <<
"# Testing setup:" << std::endl;
884 std::cout <<
" numeric: long" << std::endl;
885 std::cout <<
" layout: column-major" << std::endl;
886 retval = test<NumericT, viennacl::column_major>();
887 if ( retval == EXIT_SUCCESS )
888 std::cout <<
"# Test passed" << std::endl;
892 std::cout << std::endl;
893 std::cout <<
"----------------------------------------------" << std::endl;
894 std::cout << std::endl;
896 std::cout << std::endl;
897 std::cout <<
"------- Test completed --------" << std::endl;
898 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.
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::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.)
Class for representing non-strided subvectors of a bigger vector x.
Class for representing strided subvectors of a bigger vector x.
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.
int test_prod_rank1(STLMatrixType &std_m1, STLVectorType &std_v1, STLVectorType &std_v2, VCLMatrixType &vcl_m1, VCLVectorType1 &vcl_v1, VCLVectorType2 &vcl_v2)
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
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.