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;
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;
387 std::size_t num_rows = 141;
388 std::size_t num_cols = 79;
391 ublas::vector<NumericT> ublas_v1(num_rows);
392 for (std::size_t i = 0; i < ublas_v1.size(); ++i)
393 ublas_v1(i) = randomNumber();
394 ublas::vector<NumericT> ublas_v2 = ublas::scalar_vector<NumericT>(num_cols,
NumericT(3.1415));
397 ublas::matrix<NumericT> ublas_m1(ublas_v1.size(), ublas_v2.size());
399 for (std::size_t i = 0; i < ublas_m1.size1(); ++i)
400 for (std::size_t j = 0; j < ublas_m1.size2(); ++j)
401 ublas_m1(i,j) =
static_cast<NumericT>(0.1) * randomNumber();
404 ublas::matrix<NumericT> ublas_m2(ublas_v1.size(), ublas_v1.size());
406 for (std::size_t i = 0; i < ublas_m2.size1(); ++i)
408 for (std::size_t j = 0; j < ublas_m2.size2(); ++j)
409 ublas_m2(i,j) =
static_cast<NumericT>(-0.1) * randomNumber();
410 ublas_m2(i, i) =
static_cast<NumericT>(2) + randomNumber();
480 std::cout <<
"------------ Testing rank-1-updates and matrix-vector products ------------------" << std::endl;
482 std::cout <<
"* m = full, v1 = full, v2 = full" << std::endl;
483 retval = test_prod_rank1<NumericT>(epsilon,
484 ublas_m1, ublas_v1, ublas_v2,
485 vcl_m1_native, vcl_v1_native, vcl_v2_native);
486 if (retval == EXIT_FAILURE)
488 std::cout <<
" --- FAILED! ---" << std::endl;
492 std::cout <<
" --- PASSED ---" << std::endl;
495 std::cout <<
"* m = full, v1 = full, v2 = range" << std::endl;
496 retval = test_prod_rank1<NumericT>(epsilon,
497 ublas_m1, ublas_v1, ublas_v2,
498 vcl_m1_native, vcl_v1_native, vcl_v2_range);
499 if (retval == EXIT_FAILURE)
501 std::cout <<
" --- FAILED! ---" << std::endl;
505 std::cout <<
" --- PASSED ---" << std::endl;
508 std::cout <<
"* m = full, v1 = full, v2 = slice" << std::endl;
509 retval = test_prod_rank1<NumericT>(epsilon,
510 ublas_m1, ublas_v1, ublas_v2,
511 vcl_m1_native, vcl_v1_native, vcl_v2_slice);
512 if (retval == EXIT_FAILURE)
514 std::cout <<
" --- FAILED! ---" << std::endl;
518 std::cout <<
" --- PASSED ---" << std::endl;
524 std::cout <<
"* m = full, v1 = range, v2 = full" << std::endl;
525 retval = test_prod_rank1<NumericT>(epsilon,
526 ublas_m1, ublas_v1, ublas_v2,
527 vcl_m1_native, vcl_v1_range, vcl_v2_native);
528 if (retval == EXIT_FAILURE)
530 std::cout <<
" --- FAILED! ---" << std::endl;
534 std::cout <<
" --- PASSED ---" << std::endl;
537 std::cout <<
"* m = full, v1 = range, v2 = range" << std::endl;
538 retval = test_prod_rank1<NumericT>(epsilon,
539 ublas_m1, ublas_v1, ublas_v2,
540 vcl_m1_native, vcl_v1_range, vcl_v2_range);
541 if (retval == EXIT_FAILURE)
543 std::cout <<
" --- FAILED! ---" << std::endl;
547 std::cout <<
" --- PASSED ---" << std::endl;
550 std::cout <<
"* m = full, v1 = range, v2 = slice" << std::endl;
551 retval = test_prod_rank1<NumericT>(epsilon,
552 ublas_m1, ublas_v1, ublas_v2,
553 vcl_m1_native, vcl_v1_range, vcl_v2_slice);
554 if (retval == EXIT_FAILURE)
556 std::cout <<
" --- FAILED! ---" << std::endl;
560 std::cout <<
" --- PASSED ---" << std::endl;
566 std::cout <<
"* m = full, v1 = slice, v2 = full" << std::endl;
567 retval = test_prod_rank1<NumericT>(epsilon,
568 ublas_m1, ublas_v1, ublas_v2,
569 vcl_m1_native, vcl_v1_slice, vcl_v2_native);
570 if (retval == EXIT_FAILURE)
572 std::cout <<
" --- FAILED! ---" << std::endl;
576 std::cout <<
" --- PASSED ---" << std::endl;
579 std::cout <<
"* m = full, v1 = slice, v2 = range" << std::endl;
580 retval = test_prod_rank1<NumericT>(epsilon,
581 ublas_m1, ublas_v1, ublas_v2,
582 vcl_m1_native, vcl_v1_slice, vcl_v2_range);
583 if (retval == EXIT_FAILURE)
585 std::cout <<
" --- FAILED! ---" << std::endl;
589 std::cout <<
" --- PASSED ---" << std::endl;
592 std::cout <<
"* m = full, v1 = slice, v2 = slice" << std::endl;
593 retval = test_prod_rank1<NumericT>(epsilon,
594 ublas_m1, ublas_v1, ublas_v2,
595 vcl_m1_native, vcl_v1_slice, vcl_v2_slice);
596 if (retval == EXIT_FAILURE)
598 std::cout <<
" --- FAILED! ---" << std::endl;
602 std::cout <<
" --- PASSED ---" << std::endl;
607 std::cout <<
"* m = range, v1 = full, v2 = full" << std::endl;
608 retval = test_prod_rank1<NumericT>(epsilon,
609 ublas_m1, ublas_v1, ublas_v2,
610 vcl_m1_range, vcl_v1_native, vcl_v2_native);
611 if (retval == EXIT_FAILURE)
613 std::cout <<
" --- FAILED! ---" << std::endl;
617 std::cout <<
" --- PASSED ---" << std::endl;
620 std::cout <<
"* m = range, v1 = full, v2 = range" << std::endl;
621 retval = test_prod_rank1<NumericT>(epsilon,
622 ublas_m1, ublas_v1, ublas_v2,
623 vcl_m1_range, vcl_v1_native, vcl_v2_range);
624 if (retval == EXIT_FAILURE)
626 std::cout <<
" --- FAILED! ---" << std::endl;
630 std::cout <<
" --- PASSED ---" << std::endl;
633 std::cout <<
"* m = range, v1 = full, v2 = slice" << std::endl;
634 retval = test_prod_rank1<NumericT>(epsilon,
635 ublas_m1, ublas_v1, ublas_v2,
636 vcl_m1_range, vcl_v1_native, vcl_v2_slice);
637 if (retval == EXIT_FAILURE)
639 std::cout <<
" --- FAILED! ---" << std::endl;
643 std::cout <<
" --- PASSED ---" << std::endl;
649 std::cout <<
"* m = range, v1 = range, v2 = full" << std::endl;
650 retval = test_prod_rank1<NumericT>(epsilon,
651 ublas_m1, ublas_v1, ublas_v2,
652 vcl_m1_range, vcl_v1_range, vcl_v2_native);
653 if (retval == EXIT_FAILURE)
655 std::cout <<
" --- FAILED! ---" << std::endl;
659 std::cout <<
" --- PASSED ---" << std::endl;
662 std::cout <<
"* m = range, v1 = range, v2 = range" << std::endl;
663 retval = test_prod_rank1<NumericT>(epsilon,
664 ublas_m1, ublas_v1, ublas_v2,
665 vcl_m1_range, vcl_v1_range, vcl_v2_range);
666 if (retval == EXIT_FAILURE)
668 std::cout <<
" --- FAILED! ---" << std::endl;
672 std::cout <<
" --- PASSED ---" << std::endl;
675 std::cout <<
"* m = range, v1 = range, v2 = slice" << std::endl;
676 retval = test_prod_rank1<NumericT>(epsilon,
677 ublas_m1, ublas_v1, ublas_v2,
678 vcl_m1_range, vcl_v1_range, vcl_v2_slice);
679 if (retval == EXIT_FAILURE)
681 std::cout <<
" --- FAILED! ---" << std::endl;
685 std::cout <<
" --- PASSED ---" << std::endl;
691 std::cout <<
"* m = range, v1 = slice, v2 = full" << std::endl;
692 retval = test_prod_rank1<NumericT>(epsilon,
693 ublas_m1, ublas_v1, ublas_v2,
694 vcl_m1_range, vcl_v1_slice, vcl_v2_native);
695 if (retval == EXIT_FAILURE)
697 std::cout <<
" --- FAILED! ---" << std::endl;
701 std::cout <<
" --- PASSED ---" << std::endl;
704 std::cout <<
"* m = range, v1 = slice, v2 = range" << std::endl;
705 retval = test_prod_rank1<NumericT>(epsilon,
706 ublas_m1, ublas_v1, ublas_v2,
707 vcl_m1_range, vcl_v1_slice, vcl_v2_range);
708 if (retval == EXIT_FAILURE)
710 std::cout <<
" --- FAILED! ---" << std::endl;
714 std::cout <<
" --- PASSED ---" << std::endl;
717 std::cout <<
"* m = range, v1 = slice, v2 = slice" << std::endl;
718 retval = test_prod_rank1<NumericT>(epsilon,
719 ublas_m1, ublas_v1, ublas_v2,
720 vcl_m1_range, vcl_v1_slice, vcl_v2_slice);
721 if (retval == EXIT_FAILURE)
723 std::cout <<
" --- FAILED! ---" << std::endl;
727 std::cout <<
" --- PASSED ---" << std::endl;
732 std::cout <<
"* m = slice, v1 = full, v2 = full" << std::endl;
733 retval = test_prod_rank1<NumericT>(epsilon,
734 ublas_m1, ublas_v1, ublas_v2,
735 vcl_m1_slice, vcl_v1_native, vcl_v2_native);
736 if (retval == EXIT_FAILURE)
738 std::cout <<
" --- FAILED! ---" << std::endl;
742 std::cout <<
" --- PASSED ---" << std::endl;
745 std::cout <<
"* m = slice, v1 = full, v2 = range" << std::endl;
746 retval = test_prod_rank1<NumericT>(epsilon,
747 ublas_m1, ublas_v1, ublas_v2,
748 vcl_m1_slice, vcl_v1_native, vcl_v2_range);
749 if (retval == EXIT_FAILURE)
751 std::cout <<
" --- FAILED! ---" << std::endl;
755 std::cout <<
" --- PASSED ---" << std::endl;
758 std::cout <<
"* m = slice, v1 = full, v2 = slice" << std::endl;
759 retval = test_prod_rank1<NumericT>(epsilon,
760 ublas_m1, ublas_v1, ublas_v2,
761 vcl_m1_slice, vcl_v1_native, vcl_v2_slice);
762 if (retval == EXIT_FAILURE)
764 std::cout <<
" --- FAILED! ---" << std::endl;
768 std::cout <<
" --- PASSED ---" << std::endl;
774 std::cout <<
"* m = slice, v1 = range, v2 = full" << std::endl;
775 retval = test_prod_rank1<NumericT>(epsilon,
776 ublas_m1, ublas_v1, ublas_v2,
777 vcl_m1_slice, vcl_v1_range, vcl_v2_native);
778 if (retval == EXIT_FAILURE)
780 std::cout <<
" --- FAILED! ---" << std::endl;
784 std::cout <<
" --- PASSED ---" << std::endl;
787 std::cout <<
"* m = slice, v1 = range, v2 = range" << std::endl;
788 retval = test_prod_rank1<NumericT>(epsilon,
789 ublas_m1, ublas_v1, ublas_v2,
790 vcl_m1_slice, vcl_v1_range, vcl_v2_range);
791 if (retval == EXIT_FAILURE)
793 std::cout <<
" --- FAILED! ---" << std::endl;
797 std::cout <<
" --- PASSED ---" << std::endl;
800 std::cout <<
"* m = slice, v1 = range, v2 = slice" << std::endl;
801 retval = test_prod_rank1<NumericT>(epsilon,
802 ublas_m1, ublas_v1, ublas_v2,
803 vcl_m1_slice, vcl_v1_range, vcl_v2_slice);
804 if (retval == EXIT_FAILURE)
806 std::cout <<
" --- FAILED! ---" << std::endl;
810 std::cout <<
" --- PASSED ---" << std::endl;
816 std::cout <<
"* m = slice, v1 = slice, v2 = full" << std::endl;
817 retval = test_prod_rank1<NumericT>(epsilon,
818 ublas_m1, ublas_v1, ublas_v2,
819 vcl_m1_slice, vcl_v1_slice, vcl_v2_native);
820 if (retval == EXIT_FAILURE)
822 std::cout <<
" --- FAILED! ---" << std::endl;
826 std::cout <<
" --- PASSED ---" << std::endl;
829 std::cout <<
"* m = slice, v1 = slice, v2 = range" << std::endl;
830 retval = test_prod_rank1<NumericT>(epsilon,
831 ublas_m1, ublas_v1, ublas_v2,
832 vcl_m1_slice, vcl_v1_slice, vcl_v2_range);
833 if (retval == EXIT_FAILURE)
835 std::cout <<
" --- FAILED! ---" << std::endl;
839 std::cout <<
" --- PASSED ---" << std::endl;
842 std::cout <<
"* m = slice, v1 = slice, v2 = slice" << std::endl;
843 retval = test_prod_rank1<NumericT>(epsilon,
844 ublas_m1, ublas_v1, ublas_v2,
845 vcl_m1_slice, vcl_v1_slice, vcl_v2_slice);
846 if (retval == EXIT_FAILURE)
848 std::cout <<
" --- FAILED! ---" << std::endl;
852 std::cout <<
" --- PASSED ---" << std::endl;
861 std::cout << std::endl;
862 std::cout <<
"----------------------------------------------" << std::endl;
863 std::cout <<
"----------------------------------------------" << std::endl;
864 std::cout <<
"## Test :: Matrix" << std::endl;
865 std::cout <<
"----------------------------------------------" << std::endl;
866 std::cout <<
"----------------------------------------------" << std::endl;
867 std::cout << std::endl;
869 int retval = EXIT_SUCCESS;
871 std::cout << std::endl;
872 std::cout <<
"----------------------------------------------" << std::endl;
873 std::cout << std::endl;
876 NumericT epsilon =
NumericT(1.0E-3);
877 std::cout <<
"# Testing setup:" << std::endl;
878 std::cout <<
" eps: " << epsilon << std::endl;
879 std::cout <<
" numeric: float" << std::endl;
880 std::cout <<
" layout: row-major" << std::endl;
881 retval = test<NumericT, viennacl::row_major>(epsilon);
882 if ( retval == EXIT_SUCCESS )
883 std::cout <<
"# Test passed" << std::endl;
887 std::cout << std::endl;
888 std::cout <<
"----------------------------------------------" << std::endl;
889 std::cout << std::endl;
892 NumericT epsilon =
NumericT(1.0E-3);
893 std::cout <<
"# Testing setup:" << std::endl;
894 std::cout <<
" eps: " << epsilon << std::endl;
895 std::cout <<
" numeric: float" << std::endl;
896 std::cout <<
" layout: column-major" << std::endl;
897 retval = test<NumericT, viennacl::column_major>(epsilon);
898 if ( retval == EXIT_SUCCESS )
899 std::cout <<
"# Test passed" << std::endl;
903 std::cout << std::endl;
904 std::cout <<
"----------------------------------------------" << std::endl;
905 std::cout << std::endl;
908 #ifdef VIENNACL_WITH_OPENCL
914 NumericT epsilon = 1.0E-11;
915 std::cout <<
"# Testing setup:" << std::endl;
916 std::cout <<
" eps: " << epsilon << std::endl;
917 std::cout <<
" numeric: double" << std::endl;
918 std::cout <<
" layout: row-major" << std::endl;
919 retval = test<NumericT, viennacl::row_major>(epsilon);
920 if ( retval == EXIT_SUCCESS )
921 std::cout <<
"# Test passed" << std::endl;
925 std::cout << std::endl;
926 std::cout <<
"----------------------------------------------" << std::endl;
927 std::cout << std::endl;
930 NumericT epsilon = 1.0E-11;
931 std::cout <<
"# Testing setup:" << std::endl;
932 std::cout <<
" eps: " << epsilon << std::endl;
933 std::cout <<
" numeric: double" << std::endl;
934 std::cout <<
" layout: column-major" << std::endl;
935 retval = test<NumericT, viennacl::column_major>(epsilon);
936 if ( retval == EXIT_SUCCESS )
937 std::cout <<
"# Test passed" << std::endl;
941 std::cout << std::endl;
942 std::cout <<
"----------------------------------------------" << std::endl;
943 std::cout << std::endl;
946 std::cout << std::endl;
947 std::cout <<
"------- Test completed --------" << std::endl;
948 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) ...
A small collection of sequential random number generators.
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.