32 #include <boost/numeric/ublas/io.hpp>
33 #include <boost/numeric/ublas/triangular.hpp>
34 #include <boost/numeric/ublas/matrix_sparse.hpp>
35 #include <boost/numeric/ublas/matrix.hpp>
36 #include <boost/numeric/ublas/matrix_proxy.hpp>
37 #include <boost/numeric/ublas/lu.hpp>
38 #include <boost/numeric/ublas/io.hpp>
44 #define VIENNACL_WITH_UBLAS 1
64 template<
typename ScalarType>
69 return (s1 - s2) /
std::max(std::fabs(s1), std::fabs(s2));
73 template<
typename ScalarType,
typename VCLVectorType>
76 ublas::vector<ScalarType> v2_cpu(v2.size());
80 for (
unsigned int i=0;i<v1.size(); ++i)
82 if (
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) ) > 0 )
83 v2_cpu[i] = std::fabs(v2_cpu[i] - v1[i]) /
std::max( std::fabs(v2_cpu[i]), std::fabs(v1[i]) );
91 template<
typename ScalarType,
typename VCLMatrixType>
92 ScalarType diff(ublas::matrix<ScalarType>
const & mat1, VCLMatrixType
const & mat2)
94 ublas::matrix<ScalarType> mat2_cpu(mat2.size1(), mat2.size2());
100 for (
unsigned int i = 0; i < mat2_cpu.size1(); ++i)
102 for (
unsigned int j = 0; j < mat2_cpu.size2(); ++j)
104 act = std::fabs(mat2_cpu(i,j) - mat1(i,j)) /
std::max( std::fabs(mat2_cpu(i, j)), std::fabs(mat1(i,j)) );
116 template<
typename NumericT,
typename Epsilon,
117 typename UblasMatrixType,
typename UblasVectorType,
118 typename VCLMatrixType,
typename VCLVectorType1,
typename VCLVectorType2>
120 UblasMatrixType & ublas_m1, UblasVectorType & ublas_v1, UblasVectorType & ublas_v2,
121 VCLMatrixType & vcl_m1, VCLVectorType1 & vcl_v1, VCLVectorType2 & vcl_v2)
123 int retval = EXIT_SUCCESS;
136 std::cout <<
"Matrix-Vector product" << std::endl;
143 if ( std::fabs(
diff(ublas_v1, vcl_v1)) > epsilon )
145 std::cout <<
"# Error at operation: matrix-vector product" << std::endl;
146 std::cout <<
" diff: " << std::fabs(
diff(ublas_v1, vcl_v1)) << std::endl;
147 retval = EXIT_FAILURE;
150 std::cout <<
"Matrix-Vector product with inplace-add" << std::endl;
157 if ( std::fabs(
diff(ublas_v1, vcl_v1)) > epsilon )
159 std::cout <<
"# Error at operation: matrix-vector product" << std::endl;
160 std::cout <<
" diff: " << std::fabs(
diff(ublas_v1, vcl_v1)) << std::endl;
161 retval = EXIT_FAILURE;
164 std::cout <<
"Matrix-Vector product with inplace-sub" << std::endl;
171 if ( std::fabs(
diff(ublas_v1, vcl_v1)) > epsilon )
173 std::cout <<
"# Error at operation: matrix-vector product" << std::endl;
174 std::cout <<
" diff: " << std::fabs(
diff(ublas_v1, vcl_v1)) << std::endl;
175 retval = EXIT_FAILURE;
195 std::cout <<
"Matrix-Vector product with scaled vector" << std::endl;
211 std::cout <<
"Matrix-Vector product with scaled matrix and scaled vector" << std::endl;
228 std::cout <<
"Matrix-Vector product with scaled add" << std::endl;
229 NumericT alpha =
static_cast<NumericT
>(2.786);
230 NumericT beta =
static_cast<NumericT
>(3.1415);
240 if ( std::fabs(
diff(ublas_v1, vcl_v1)) > epsilon )
242 std::cout <<
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
243 std::cout <<
" diff: " << std::fabs(
diff(ublas_v1, vcl_v1)) << std::endl;
244 retval = EXIT_FAILURE;
247 std::cout <<
"Matrix-Vector product with scaled add, inplace-add" << std::endl;
257 if ( std::fabs(
diff(ublas_v1, vcl_v1)) > epsilon )
259 std::cout <<
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
260 std::cout <<
" diff: " << std::fabs(
diff(ublas_v1, vcl_v1)) << std::endl;
261 retval = EXIT_FAILURE;
264 std::cout <<
"Matrix-Vector product with scaled add, inplace-sub" << std::endl;
274 if ( std::fabs(
diff(ublas_v1, vcl_v1)) > epsilon )
276 std::cout <<
"# Error at operation: matrix-vector product with scaled additions" << std::endl;
277 std::cout <<
" diff: " << std::fabs(
diff(ublas_v1, vcl_v1)) << std::endl;
278 retval = EXIT_FAILURE;
286 std::cout <<
"Transposed Matrix-Vector product" << std::endl;
293 if ( std::fabs(
diff(ublas_v2, vcl_v2)) > epsilon )
295 std::cout <<
"# Error at operation: transposed matrix-vector product" << std::endl;
296 std::cout <<
" diff: " << std::fabs(
diff(ublas_v2, vcl_v2)) << std::endl;
297 retval = EXIT_FAILURE;
300 std::cout <<
"Transposed Matrix-Vector product, inplace-add" << std::endl;
307 if ( std::fabs(
diff(ublas_v2, vcl_v2)) > epsilon )
309 std::cout <<
"# Error at operation: transposed matrix-vector product" << std::endl;
310 std::cout <<
" diff: " << std::fabs(
diff(ublas_v2, vcl_v2)) << std::endl;
311 retval = EXIT_FAILURE;
314 std::cout <<
"Transposed Matrix-Vector product, inplace-sub" << std::endl;
321 if ( std::fabs(
diff(ublas_v2, vcl_v2)) > epsilon )
323 std::cout <<
"# Error at operation: transposed matrix-vector product" << std::endl;
324 std::cout <<
" diff: " << std::fabs(
diff(ublas_v2, vcl_v2)) << std::endl;
325 retval = EXIT_FAILURE;
329 std::cout <<
"Transposed Matrix-Vector product with scaled add" << std::endl;
336 if ( std::fabs(
diff(ublas_v2, vcl_v2)) > epsilon )
338 std::cout <<
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
339 std::cout <<
" diff: " << std::fabs(
diff(ublas_v2, vcl_v2)) << std::endl;
340 retval = EXIT_FAILURE;
343 std::cout <<
"Transposed Matrix-Vector product with scaled add, inplace-add" << std::endl;
350 if ( std::fabs(
diff(ublas_v2, vcl_v2)) > epsilon )
352 std::cout <<
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
353 std::cout <<
" diff: " << std::fabs(
diff(ublas_v2, vcl_v2)) << std::endl;
354 retval = EXIT_FAILURE;
357 std::cout <<
"Transposed Matrix-Vector product with scaled add, inplace-sub" << std::endl;
364 if ( std::fabs(
diff(ublas_v2, vcl_v2)) > epsilon )
366 std::cout <<
"# Error at operation: transposed matrix-vector product with scaled additions" << std::endl;
367 std::cout <<
" diff: " << std::fabs(
diff(ublas_v2, vcl_v2)) << std::endl;
368 retval = EXIT_FAILURE;
380 template<
typename NumericT,
typename F,
typename Epsilon >
381 int test(Epsilon
const& epsilon)
383 int retval = EXIT_SUCCESS;
385 std::size_t num_rows = 141;
386 std::size_t num_cols = 79;
389 ublas::vector<NumericT> ublas_v1(num_rows);
390 for (std::size_t i = 0; i < ublas_v1.size(); ++i)
391 ublas_v1(i) = random<NumericT>();
392 ublas::vector<NumericT> ublas_v2 = ublas::scalar_vector<NumericT>(num_cols, NumericT(3.1415));
395 ublas::matrix<NumericT> ublas_m1(ublas_v1.size(), ublas_v2.size());
397 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
398 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
399 ublas_m1(i,j) =
static_cast<NumericT
>(0.1) * random<NumericT>();
402 ublas::matrix<NumericT> ublas_m2(ublas_v1.size(), ublas_v1.size());
404 for (std::size_t i = 0; i < ublas_m2.size1(); ++i)
406 for (std::size_t j = 0; j < ublas_m2.size2(); ++j)
407 ublas_m2(i,j) =
static_cast<NumericT
>(-0.1) * random<NumericT>();
408 ublas_m2(i, i) =
static_cast<NumericT
>(2) + random<NumericT>();
478 std::cout <<
"------------ Testing rank-1-updates and matrix-vector products ------------------" << std::endl;
480 std::cout <<
"* m = full, v1 = full, v2 = full" << std::endl;
481 retval = test_prod_rank1<NumericT>(epsilon,
482 ublas_m1, ublas_v1, ublas_v2,
483 vcl_m1_native, vcl_v1_native, vcl_v2_native);
484 if (retval == EXIT_FAILURE)
486 std::cout <<
" --- FAILED! ---" << std::endl;
490 std::cout <<
" --- PASSED ---" << std::endl;
493 std::cout <<
"* m = full, v1 = full, v2 = range" << std::endl;
494 retval = test_prod_rank1<NumericT>(epsilon,
495 ublas_m1, ublas_v1, ublas_v2,
496 vcl_m1_native, vcl_v1_native, vcl_v2_range);
497 if (retval == EXIT_FAILURE)
499 std::cout <<
" --- FAILED! ---" << std::endl;
503 std::cout <<
" --- PASSED ---" << std::endl;
506 std::cout <<
"* m = full, v1 = full, v2 = slice" << std::endl;
507 retval = test_prod_rank1<NumericT>(epsilon,
508 ublas_m1, ublas_v1, ublas_v2,
509 vcl_m1_native, vcl_v1_native, vcl_v2_slice);
510 if (retval == EXIT_FAILURE)
512 std::cout <<
" --- FAILED! ---" << std::endl;
516 std::cout <<
" --- PASSED ---" << std::endl;
522 std::cout <<
"* m = full, v1 = range, v2 = full" << std::endl;
523 retval = test_prod_rank1<NumericT>(epsilon,
524 ublas_m1, ublas_v1, ublas_v2,
525 vcl_m1_native, vcl_v1_range, vcl_v2_native);
526 if (retval == EXIT_FAILURE)
528 std::cout <<
" --- FAILED! ---" << std::endl;
532 std::cout <<
" --- PASSED ---" << std::endl;
535 std::cout <<
"* m = full, v1 = range, v2 = range" << std::endl;
536 retval = test_prod_rank1<NumericT>(epsilon,
537 ublas_m1, ublas_v1, ublas_v2,
538 vcl_m1_native, vcl_v1_range, vcl_v2_range);
539 if (retval == EXIT_FAILURE)
541 std::cout <<
" --- FAILED! ---" << std::endl;
545 std::cout <<
" --- PASSED ---" << std::endl;
548 std::cout <<
"* m = full, v1 = range, v2 = slice" << std::endl;
549 retval = test_prod_rank1<NumericT>(epsilon,
550 ublas_m1, ublas_v1, ublas_v2,
551 vcl_m1_native, vcl_v1_range, vcl_v2_slice);
552 if (retval == EXIT_FAILURE)
554 std::cout <<
" --- FAILED! ---" << std::endl;
558 std::cout <<
" --- PASSED ---" << std::endl;
564 std::cout <<
"* m = full, v1 = slice, v2 = full" << std::endl;
565 retval = test_prod_rank1<NumericT>(epsilon,
566 ublas_m1, ublas_v1, ublas_v2,
567 vcl_m1_native, vcl_v1_slice, vcl_v2_native);
568 if (retval == EXIT_FAILURE)
570 std::cout <<
" --- FAILED! ---" << std::endl;
574 std::cout <<
" --- PASSED ---" << std::endl;
577 std::cout <<
"* m = full, v1 = slice, v2 = range" << std::endl;
578 retval = test_prod_rank1<NumericT>(epsilon,
579 ublas_m1, ublas_v1, ublas_v2,
580 vcl_m1_native, vcl_v1_slice, vcl_v2_range);
581 if (retval == EXIT_FAILURE)
583 std::cout <<
" --- FAILED! ---" << std::endl;
587 std::cout <<
" --- PASSED ---" << std::endl;
590 std::cout <<
"* m = full, v1 = slice, v2 = slice" << std::endl;
591 retval = test_prod_rank1<NumericT>(epsilon,
592 ublas_m1, ublas_v1, ublas_v2,
593 vcl_m1_native, vcl_v1_slice, vcl_v2_slice);
594 if (retval == EXIT_FAILURE)
596 std::cout <<
" --- FAILED! ---" << std::endl;
600 std::cout <<
" --- PASSED ---" << std::endl;
605 std::cout <<
"* m = range, v1 = full, v2 = full" << std::endl;
606 retval = test_prod_rank1<NumericT>(epsilon,
607 ublas_m1, ublas_v1, ublas_v2,
608 vcl_m1_range, vcl_v1_native, vcl_v2_native);
609 if (retval == EXIT_FAILURE)
611 std::cout <<
" --- FAILED! ---" << std::endl;
615 std::cout <<
" --- PASSED ---" << std::endl;
618 std::cout <<
"* m = range, v1 = full, v2 = range" << std::endl;
619 retval = test_prod_rank1<NumericT>(epsilon,
620 ublas_m1, ublas_v1, ublas_v2,
621 vcl_m1_range, vcl_v1_native, vcl_v2_range);
622 if (retval == EXIT_FAILURE)
624 std::cout <<
" --- FAILED! ---" << std::endl;
628 std::cout <<
" --- PASSED ---" << std::endl;
631 std::cout <<
"* m = range, v1 = full, v2 = slice" << std::endl;
632 retval = test_prod_rank1<NumericT>(epsilon,
633 ublas_m1, ublas_v1, ublas_v2,
634 vcl_m1_range, vcl_v1_native, vcl_v2_slice);
635 if (retval == EXIT_FAILURE)
637 std::cout <<
" --- FAILED! ---" << std::endl;
641 std::cout <<
" --- PASSED ---" << std::endl;
647 std::cout <<
"* m = range, v1 = range, v2 = full" << std::endl;
648 retval = test_prod_rank1<NumericT>(epsilon,
649 ublas_m1, ublas_v1, ublas_v2,
650 vcl_m1_range, vcl_v1_range, vcl_v2_native);
651 if (retval == EXIT_FAILURE)
653 std::cout <<
" --- FAILED! ---" << std::endl;
657 std::cout <<
" --- PASSED ---" << std::endl;
660 std::cout <<
"* m = range, v1 = range, v2 = range" << std::endl;
661 retval = test_prod_rank1<NumericT>(epsilon,
662 ublas_m1, ublas_v1, ublas_v2,
663 vcl_m1_range, vcl_v1_range, vcl_v2_range);
664 if (retval == EXIT_FAILURE)
666 std::cout <<
" --- FAILED! ---" << std::endl;
670 std::cout <<
" --- PASSED ---" << std::endl;
673 std::cout <<
"* m = range, v1 = range, v2 = slice" << std::endl;
674 retval = test_prod_rank1<NumericT>(epsilon,
675 ublas_m1, ublas_v1, ublas_v2,
676 vcl_m1_range, vcl_v1_range, vcl_v2_slice);
677 if (retval == EXIT_FAILURE)
679 std::cout <<
" --- FAILED! ---" << std::endl;
683 std::cout <<
" --- PASSED ---" << std::endl;
689 std::cout <<
"* m = range, v1 = slice, v2 = full" << std::endl;
690 retval = test_prod_rank1<NumericT>(epsilon,
691 ublas_m1, ublas_v1, ublas_v2,
692 vcl_m1_range, vcl_v1_slice, vcl_v2_native);
693 if (retval == EXIT_FAILURE)
695 std::cout <<
" --- FAILED! ---" << std::endl;
699 std::cout <<
" --- PASSED ---" << std::endl;
702 std::cout <<
"* m = range, v1 = slice, v2 = range" << std::endl;
703 retval = test_prod_rank1<NumericT>(epsilon,
704 ublas_m1, ublas_v1, ublas_v2,
705 vcl_m1_range, vcl_v1_slice, vcl_v2_range);
706 if (retval == EXIT_FAILURE)
708 std::cout <<
" --- FAILED! ---" << std::endl;
712 std::cout <<
" --- PASSED ---" << std::endl;
715 std::cout <<
"* m = range, v1 = slice, v2 = slice" << std::endl;
716 retval = test_prod_rank1<NumericT>(epsilon,
717 ublas_m1, ublas_v1, ublas_v2,
718 vcl_m1_range, vcl_v1_slice, vcl_v2_slice);
719 if (retval == EXIT_FAILURE)
721 std::cout <<
" --- FAILED! ---" << std::endl;
725 std::cout <<
" --- PASSED ---" << std::endl;
730 std::cout <<
"* m = slice, v1 = full, v2 = full" << std::endl;
731 retval = test_prod_rank1<NumericT>(epsilon,
732 ublas_m1, ublas_v1, ublas_v2,
733 vcl_m1_slice, vcl_v1_native, vcl_v2_native);
734 if (retval == EXIT_FAILURE)
736 std::cout <<
" --- FAILED! ---" << std::endl;
740 std::cout <<
" --- PASSED ---" << std::endl;
743 std::cout <<
"* m = slice, v1 = full, v2 = range" << std::endl;
744 retval = test_prod_rank1<NumericT>(epsilon,
745 ublas_m1, ublas_v1, ublas_v2,
746 vcl_m1_slice, vcl_v1_native, vcl_v2_range);
747 if (retval == EXIT_FAILURE)
749 std::cout <<
" --- FAILED! ---" << std::endl;
753 std::cout <<
" --- PASSED ---" << std::endl;
756 std::cout <<
"* m = slice, v1 = full, v2 = slice" << std::endl;
757 retval = test_prod_rank1<NumericT>(epsilon,
758 ublas_m1, ublas_v1, ublas_v2,
759 vcl_m1_slice, vcl_v1_native, vcl_v2_slice);
760 if (retval == EXIT_FAILURE)
762 std::cout <<
" --- FAILED! ---" << std::endl;
766 std::cout <<
" --- PASSED ---" << std::endl;
772 std::cout <<
"* m = slice, v1 = range, v2 = full" << std::endl;
773 retval = test_prod_rank1<NumericT>(epsilon,
774 ublas_m1, ublas_v1, ublas_v2,
775 vcl_m1_slice, vcl_v1_range, vcl_v2_native);
776 if (retval == EXIT_FAILURE)
778 std::cout <<
" --- FAILED! ---" << std::endl;
782 std::cout <<
" --- PASSED ---" << std::endl;
785 std::cout <<
"* m = slice, v1 = range, v2 = range" << std::endl;
786 retval = test_prod_rank1<NumericT>(epsilon,
787 ublas_m1, ublas_v1, ublas_v2,
788 vcl_m1_slice, vcl_v1_range, vcl_v2_range);
789 if (retval == EXIT_FAILURE)
791 std::cout <<
" --- FAILED! ---" << std::endl;
795 std::cout <<
" --- PASSED ---" << std::endl;
798 std::cout <<
"* m = slice, v1 = range, v2 = slice" << std::endl;
799 retval = test_prod_rank1<NumericT>(epsilon,
800 ublas_m1, ublas_v1, ublas_v2,
801 vcl_m1_slice, vcl_v1_range, vcl_v2_slice);
802 if (retval == EXIT_FAILURE)
804 std::cout <<
" --- FAILED! ---" << std::endl;
808 std::cout <<
" --- PASSED ---" << std::endl;
814 std::cout <<
"* m = slice, v1 = slice, v2 = full" << std::endl;
815 retval = test_prod_rank1<NumericT>(epsilon,
816 ublas_m1, ublas_v1, ublas_v2,
817 vcl_m1_slice, vcl_v1_slice, vcl_v2_native);
818 if (retval == EXIT_FAILURE)
820 std::cout <<
" --- FAILED! ---" << std::endl;
824 std::cout <<
" --- PASSED ---" << std::endl;
827 std::cout <<
"* m = slice, v1 = slice, v2 = range" << std::endl;
828 retval = test_prod_rank1<NumericT>(epsilon,
829 ublas_m1, ublas_v1, ublas_v2,
830 vcl_m1_slice, vcl_v1_slice, vcl_v2_range);
831 if (retval == EXIT_FAILURE)
833 std::cout <<
" --- FAILED! ---" << std::endl;
837 std::cout <<
" --- PASSED ---" << std::endl;
840 std::cout <<
"* m = slice, v1 = slice, v2 = slice" << std::endl;
841 retval = test_prod_rank1<NumericT>(epsilon,
842 ublas_m1, ublas_v1, ublas_v2,
843 vcl_m1_slice, vcl_v1_slice, vcl_v2_slice);
844 if (retval == EXIT_FAILURE)
846 std::cout <<
" --- FAILED! ---" << std::endl;
850 std::cout <<
" --- PASSED ---" << std::endl;
859 std::cout << std::endl;
860 std::cout <<
"----------------------------------------------" << std::endl;
861 std::cout <<
"----------------------------------------------" << std::endl;
862 std::cout <<
"## Test :: Matrix" << std::endl;
863 std::cout <<
"----------------------------------------------" << std::endl;
864 std::cout <<
"----------------------------------------------" << std::endl;
865 std::cout << std::endl;
867 int retval = EXIT_SUCCESS;
869 std::cout << std::endl;
870 std::cout <<
"----------------------------------------------" << std::endl;
871 std::cout << std::endl;
873 typedef float NumericT;
874 NumericT epsilon = NumericT(1.0E-3);
875 std::cout <<
"# Testing setup:" << std::endl;
876 std::cout <<
" eps: " << epsilon << std::endl;
877 std::cout <<
" numeric: float" << std::endl;
878 std::cout <<
" layout: row-major" << std::endl;
879 retval = test<NumericT, viennacl::row_major>(epsilon);
880 if ( retval == EXIT_SUCCESS )
881 std::cout <<
"# Test passed" << std::endl;
885 std::cout << std::endl;
886 std::cout <<
"----------------------------------------------" << std::endl;
887 std::cout << std::endl;
889 typedef float NumericT;
890 NumericT epsilon = NumericT(1.0E-3);
891 std::cout <<
"# Testing setup:" << std::endl;
892 std::cout <<
" eps: " << epsilon << std::endl;
893 std::cout <<
" numeric: float" << std::endl;
894 std::cout <<
" layout: column-major" << std::endl;
895 retval = test<NumericT, viennacl::column_major>(epsilon);
896 if ( retval == EXIT_SUCCESS )
897 std::cout <<
"# Test passed" << std::endl;
901 std::cout << std::endl;
902 std::cout <<
"----------------------------------------------" << std::endl;
903 std::cout << std::endl;
906 #ifdef VIENNACL_WITH_OPENCL
911 typedef double NumericT;
912 NumericT epsilon = 1.0E-11;
913 std::cout <<
"# Testing setup:" << std::endl;
914 std::cout <<
" eps: " << epsilon << std::endl;
915 std::cout <<
" numeric: double" << std::endl;
916 std::cout <<
" layout: row-major" << std::endl;
917 retval = test<NumericT, viennacl::row_major>(epsilon);
918 if ( retval == EXIT_SUCCESS )
919 std::cout <<
"# Test passed" << std::endl;
923 std::cout << std::endl;
924 std::cout <<
"----------------------------------------------" << std::endl;
925 std::cout << std::endl;
927 typedef double NumericT;
928 NumericT epsilon = 1.0E-11;
929 std::cout <<
"# Testing setup:" << std::endl;
930 std::cout <<
" eps: " << epsilon << std::endl;
931 std::cout <<
" numeric: double" << std::endl;
932 std::cout <<
" layout: column-major" << std::endl;
933 retval = test<NumericT, viennacl::column_major>(epsilon);
934 if ( retval == EXIT_SUCCESS )
935 std::cout <<
"# Test passed" << std::endl;
939 std::cout << std::endl;
940 std::cout <<
"----------------------------------------------" << std::endl;
941 std::cout << std::endl;
944 std::cout << std::endl;
945 std::cout <<
"------- Test completed --------" << std::endl;
946 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...
ScalarType diff(ScalarType &s1, viennacl::scalar< ScalarType > &s2)
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.
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)
int test(Epsilon const &epsilon)
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)
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.
Implementations of LU factorization for row-major and column-major dense matrices.
Implementations of dense direct solvers are found here.
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) ...
int test_prod_rank1(Epsilon const &epsilon, UblasMatrixType &ublas_m1, UblasVectorType &ublas_v1, UblasVectorType &ublas_v2, VCLMatrixType &vcl_m1, VCLVectorType1 &vcl_v1, VCLVectorType2 &vcl_v2)
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;'.
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.