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>
44 #define VIENNACL_WITH_UBLAS 1
60 using namespace boost::numeric;
64 template<
typename ScalarType>
69 return (s1 - s2) /
std::max(std::fabs(s1), std::fabs(s2));
73 template<
typename ScalarType>
76 ublas::vector<ScalarType> v2_cpu(v2.
size());
80 for (std::size_t 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]) );
92 template<
typename ScalarType,
typename VCLMatrixType>
95 ublas::matrix<ScalarType> mat2_cpu(mat2.size1(), mat2.size2());
101 for (
unsigned int i = 0; i < mat2_cpu.size1(); ++i)
103 for (
unsigned int j = 0; j < mat2_cpu.size2(); ++j)
105 act = std::fabs(mat2_cpu(i,j) - mat1(i,j)) /
std::max( std::fabs(mat2_cpu(i, j)), std::fabs(mat1(i,j)) );
124 template<
typename NumericT,
typename Epsilon,
125 typename ReferenceMatrixTypeA,
typename ReferenceMatrixTypeB,
typename ReferenceMatrixTypeC,
126 typename MatrixTypeA,
typename MatrixTypeB,
typename MatrixTypeC>
129 ReferenceMatrixTypeA
const & A, ReferenceMatrixTypeA
const & A_trans,
130 ReferenceMatrixTypeB
const & B, ReferenceMatrixTypeB
const & B_trans,
131 ReferenceMatrixTypeC & C,
133 MatrixTypeA
const & vcl_A, MatrixTypeA
const & vcl_A_trans,
134 MatrixTypeB
const & vcl_B, MatrixTypeB
const & vcl_B_trans,
138 int retval = EXIT_SUCCESS;
139 NumericT act_diff = 0;
148 act_diff = std::fabs(
diff(C, vcl_C));
150 if ( act_diff > epsilon )
152 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
153 std::cout <<
" diff: " << act_diff << std::endl;
154 retval = EXIT_FAILURE;
157 std::cout <<
"Test C = A * B passed!" << std::endl;
165 act_diff = std::fabs(
diff(C, vcl_C));
167 if ( act_diff > epsilon )
169 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
170 std::cout <<
" diff: " << act_diff << std::endl;
171 retval = EXIT_FAILURE;
174 std::cout <<
"Test C += A * B passed!" << std::endl;
181 act_diff = std::fabs(
diff(C, vcl_C));
183 if ( act_diff > epsilon )
185 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
186 std::cout <<
" diff: " << act_diff << std::endl;
187 retval = EXIT_FAILURE;
190 std::cout <<
"Test C -= A * B passed!" << std::endl;
202 act_diff = std::fabs(
diff(C, vcl_C));
204 if ( act_diff > epsilon )
206 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
207 std::cout <<
" diff: " << act_diff << std::endl;
208 retval = EXIT_FAILURE;
211 std::cout <<
"Test C = A * trans(B) passed!" << std::endl;
219 act_diff = std::fabs(
diff(C, vcl_C));
221 if ( act_diff > epsilon )
223 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
224 std::cout <<
" diff: " << act_diff << std::endl;
225 retval = EXIT_FAILURE;
228 std::cout <<
"Test C += A * trans(B) passed!" << std::endl;
236 act_diff = std::fabs(
diff(C, vcl_C));
238 if ( act_diff > epsilon )
240 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
241 std::cout <<
" diff: " << act_diff << std::endl;
242 retval = EXIT_FAILURE;
245 std::cout <<
"Test C -= A * trans(B) passed!" << std::endl;
255 act_diff = std::fabs(
diff(C, vcl_C));
257 if ( act_diff > epsilon )
259 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
260 std::cout <<
" diff: " << act_diff << std::endl;
261 retval = EXIT_FAILURE;
264 std::cout <<
"Test C = trans(A) * B passed!" << std::endl;
272 act_diff = std::fabs(
diff(C, vcl_C));
274 if ( act_diff > epsilon )
276 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
277 std::cout <<
" diff: " << act_diff << std::endl;
278 retval = EXIT_FAILURE;
281 std::cout <<
"Test C += trans(A) * B passed!" << std::endl;
289 act_diff = std::fabs(
diff(C, vcl_C));
291 if ( act_diff > epsilon )
293 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
294 std::cout <<
" diff: " << act_diff << std::endl;
295 retval = EXIT_FAILURE;
298 std::cout <<
"Test C -= trans(A) * B passed!" << std::endl;
310 act_diff = std::fabs(
diff(C, vcl_C));
312 if ( act_diff > epsilon )
314 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
315 std::cout <<
" diff: " << act_diff << std::endl;
316 retval = EXIT_FAILURE;
319 std::cout <<
"Test C = trans(A) * trans(B) passed!" << std::endl;
326 act_diff = std::fabs(
diff(C, vcl_C));
328 if ( act_diff > epsilon )
330 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
331 std::cout <<
" diff: " << act_diff << std::endl;
332 retval = EXIT_FAILURE;
335 std::cout <<
"Test C += trans(A) * trans(B) passed!" << std::endl;
343 act_diff = std::fabs(
diff(C, vcl_C));
345 if ( act_diff > epsilon )
347 std::cout <<
"# Error at operation: matrix-matrix product" << std::endl;
348 std::cout <<
" diff: " << act_diff << std::endl;
349 retval = EXIT_FAILURE;
352 std::cout <<
"Test C -= trans(A) * trans(B) passed!" << std::endl;
362 template<
typename NumericT,
typename F_A,
typename F_B,
typename F_C,
typename Epsilon >
367 std::size_t matrix_size1 = 29;
368 std::size_t matrix_size2 = 47;
369 std::size_t matrix_size3 = 33;
380 ublas::matrix<NumericT> A(matrix_size1, matrix_size2);
381 ublas::matrix<NumericT> big_A = ublas::scalar_matrix<NumericT>(4*matrix_size1, 4*matrix_size2, NumericT(3.1415));
383 ublas::matrix<NumericT> B(matrix_size2, matrix_size3);
384 ublas::matrix<NumericT> big_B = ublas::scalar_matrix<NumericT>(4*matrix_size2, 4*matrix_size3, NumericT(42.0));
386 ublas::matrix<NumericT> C(matrix_size1, matrix_size3);
389 for (
unsigned int i = 0; i < A.size1(); ++i)
390 for (
unsigned int j = 0; j < A.size2(); ++j)
391 A(i,j) =
static_cast<NumericT
>(0.1) * random<NumericT>();
392 for (
unsigned int i = 0; i < B.size1(); ++i)
393 for (
unsigned int j = 0; j < B.size2(); ++j)
394 B(i,j) =
static_cast<NumericT
>(0.1) * random<NumericT>();
396 ublas::matrix<NumericT> A_trans =
trans(A);
397 ublas::matrix<NumericT> big_A_trans =
trans(big_A);
399 ublas::matrix<NumericT> B_trans =
trans(B);
400 ublas::matrix<NumericT> big_B_trans =
trans(big_B);
486 std::cout <<
"--- Part 1: Testing matrix-matrix products ---" << std::endl;
494 std::cout <<
"Now using A=matrix, B=matrix, C=matrix" << std::endl;
495 ret = test_prod<NumericT>(epsilon,
496 A, A_trans, B, B_trans, C,
500 if (ret != EXIT_SUCCESS)
506 std::cout <<
"Now using A=matrix, B=matrix, C=range" << std::endl;
507 ret = test_prod<NumericT>(epsilon,
508 A, A_trans, B, B_trans, C,
512 if (ret != EXIT_SUCCESS)
517 std::cout <<
"Now using A=matrix, B=matrix, C=slice" << std::endl;
518 ret = test_prod<NumericT>(epsilon,
519 A, A_trans, B, B_trans, C,
523 if (ret != EXIT_SUCCESS)
530 std::cout <<
"Now using A=matrix, B=range, C=matrix" << std::endl;
531 ret = test_prod<NumericT>(epsilon,
532 A, A_trans, B, B_trans, C,
534 vcl_range_B, vcl_range_B_trans,
536 if (ret != EXIT_SUCCESS)
542 std::cout <<
"Now using A=matrix, B=range, C=range" << std::endl;
543 ret = test_prod<NumericT>(epsilon,
544 A, A_trans, B, B_trans, C,
546 vcl_range_B, vcl_range_B_trans,
548 if (ret != EXIT_SUCCESS)
553 std::cout <<
"Now using A=matrix, B=range, C=slice" << std::endl;
554 ret = test_prod<NumericT>(epsilon,
555 A, A_trans, B, B_trans, C,
557 vcl_range_B, vcl_range_B_trans,
559 if (ret != EXIT_SUCCESS)
565 std::cout <<
"Now using A=matrix, B=slice, C=matrix" << std::endl;
566 ret = test_prod<NumericT>(epsilon,
567 A, A_trans, B, B_trans, C,
569 vcl_slice_B, vcl_slice_B_trans,
571 if (ret != EXIT_SUCCESS)
577 std::cout <<
"Now using A=matrix, B=slice, C=range" << std::endl;
578 ret = test_prod<NumericT>(epsilon,
579 A, A_trans, B, B_trans, C,
581 vcl_slice_B, vcl_slice_B_trans,
583 if (ret != EXIT_SUCCESS)
588 std::cout <<
"Now using A=matrix, B=slice, C=slice" << std::endl;
589 ret = test_prod<NumericT>(epsilon,
590 A, A_trans, B, B_trans, C,
592 vcl_slice_B, vcl_slice_B_trans,
594 if (ret != EXIT_SUCCESS)
604 std::cout <<
"Now using A=range, B=matrix, C=matrix" << std::endl;
605 ret = test_prod<NumericT>(epsilon,
606 A, A_trans, B, B_trans, C,
607 vcl_range_A, vcl_range_A_trans,
610 if (ret != EXIT_SUCCESS)
616 std::cout <<
"Now using A=range, B=matrix, C=range" << std::endl;
617 ret = test_prod<NumericT>(epsilon,
618 A, A_trans, B, B_trans, C,
619 vcl_range_A, vcl_range_A_trans,
622 if (ret != EXIT_SUCCESS)
627 std::cout <<
"Now using A=range, B=matrix, C=slice" << std::endl;
628 ret = test_prod<NumericT>(epsilon,
629 A, A_trans, B, B_trans, C,
630 vcl_range_A, vcl_range_A_trans,
633 if (ret != EXIT_SUCCESS)
640 std::cout <<
"Now using A=range, B=range, C=matrix" << std::endl;
641 ret = test_prod<NumericT>(epsilon,
642 A, A_trans, B, B_trans, C,
643 vcl_range_A, vcl_range_A_trans,
644 vcl_range_B, vcl_range_B_trans,
646 if (ret != EXIT_SUCCESS)
652 std::cout <<
"Now using A=range, B=range, C=range" << std::endl;
653 ret = test_prod<NumericT>(epsilon,
654 A, A_trans, B, B_trans, C,
655 vcl_range_A, vcl_range_A_trans,
656 vcl_range_B, vcl_range_B_trans,
658 if (ret != EXIT_SUCCESS)
663 std::cout <<
"Now using A=range, B=range, C=slice" << std::endl;
664 ret = test_prod<NumericT>(epsilon,
665 A, A_trans, B, B_trans, C,
666 vcl_range_A, vcl_range_A_trans,
667 vcl_range_B, vcl_range_B_trans,
669 if (ret != EXIT_SUCCESS)
675 std::cout <<
"Now using A=range, B=slice, C=matrix" << std::endl;
676 ret = test_prod<NumericT>(epsilon,
677 A, A_trans, B, B_trans, C,
678 vcl_range_A, vcl_range_A_trans,
679 vcl_slice_B, vcl_slice_B_trans,
681 if (ret != EXIT_SUCCESS)
687 std::cout <<
"Now using A=range, B=slice, C=range" << std::endl;
688 ret = test_prod<NumericT>(epsilon,
689 A, A_trans, B, B_trans, C,
690 vcl_range_A, vcl_range_A_trans,
691 vcl_slice_B, vcl_slice_B_trans,
693 if (ret != EXIT_SUCCESS)
698 std::cout <<
"Now using A=range, B=slice, C=slice" << std::endl;
699 ret = test_prod<NumericT>(epsilon,
700 A, A_trans, B, B_trans, C,
701 vcl_range_A, vcl_range_A_trans,
702 vcl_slice_B, vcl_slice_B_trans,
704 if (ret != EXIT_SUCCESS)
715 std::cout <<
"Now using A=slice, B=matrix, C=matrix" << std::endl;
716 ret = test_prod<NumericT>(epsilon,
717 A, A_trans, B, B_trans, C,
718 vcl_slice_A, vcl_slice_A_trans,
721 if (ret != EXIT_SUCCESS)
727 std::cout <<
"Now using A=slice, B=matrix, C=range" << std::endl;
728 ret = test_prod<NumericT>(epsilon,
729 A, A_trans, B, B_trans, C,
730 vcl_slice_A, vcl_slice_A_trans,
733 if (ret != EXIT_SUCCESS)
738 std::cout <<
"Now using A=slice, B=matrix, C=slice" << std::endl;
739 ret = test_prod<NumericT>(epsilon,
740 A, A_trans, B, B_trans, C,
741 vcl_slice_A, vcl_slice_A_trans,
744 if (ret != EXIT_SUCCESS)
751 std::cout <<
"Now using A=slice, B=range, C=matrix" << std::endl;
752 ret = test_prod<NumericT>(epsilon,
753 A, A_trans, B, B_trans, C,
754 vcl_slice_A, vcl_slice_A_trans,
755 vcl_range_B, vcl_range_B_trans,
757 if (ret != EXIT_SUCCESS)
763 std::cout <<
"Now using A=slice, B=range, C=range" << std::endl;
764 ret = test_prod<NumericT>(epsilon,
765 A, A_trans, B, B_trans, C,
766 vcl_slice_A, vcl_slice_A_trans,
767 vcl_range_B, vcl_range_B_trans,
769 if (ret != EXIT_SUCCESS)
774 std::cout <<
"Now using A=slice, B=range, C=slice" << std::endl;
775 ret = test_prod<NumericT>(epsilon,
776 A, A_trans, B, B_trans, C,
777 vcl_slice_A, vcl_slice_A_trans,
778 vcl_range_B, vcl_range_B_trans,
780 if (ret != EXIT_SUCCESS)
786 std::cout <<
"Now using A=slice, B=slice, C=matrix" << std::endl;
787 ret = test_prod<NumericT>(epsilon,
788 A, A_trans, B, B_trans, C,
789 vcl_slice_A, vcl_slice_A_trans,
790 vcl_slice_B, vcl_slice_B_trans,
792 if (ret != EXIT_SUCCESS)
798 std::cout <<
"Now using A=slice, B=slice, C=range" << std::endl;
799 ret = test_prod<NumericT>(epsilon,
800 A, A_trans, B, B_trans, C,
801 vcl_slice_A, vcl_slice_A_trans,
802 vcl_slice_B, vcl_slice_B_trans,
804 if (ret != EXIT_SUCCESS)
809 std::cout <<
"Now using A=slice, B=slice, C=slice" << std::endl;
810 ret = test_prod<NumericT>(epsilon,
811 A, A_trans, B, B_trans, C,
812 vcl_slice_A, vcl_slice_A_trans,
813 vcl_slice_B, vcl_slice_B_trans,
815 if (ret != EXIT_SUCCESS)
830 template<
typename NumericT,
typename Epsilon >
831 int test(Epsilon
const& epsilon)
835 std::cout <<
"///////////////////////////////////////" << std::endl;
836 std::cout <<
"/// Now testing A=row, B=row, C=row ///" << std::endl;
837 std::cout <<
"///////////////////////////////////////" << std::endl;
838 ret = test_prod<NumericT, viennacl::row_major, viennacl::row_major, viennacl::row_major>(epsilon);
839 if (ret != EXIT_SUCCESS)
842 std::cout <<
"///////////////////////////////////////" << std::endl;
843 std::cout <<
"/// Now testing A=row, B=row, C=col ///" << std::endl;
844 std::cout <<
"///////////////////////////////////////" << std::endl;
845 ret = test_prod<NumericT, viennacl::row_major, viennacl::row_major, viennacl::column_major>(epsilon);
846 if (ret != EXIT_SUCCESS)
849 std::cout <<
"///////////////////////////////////////" << std::endl;
850 std::cout <<
"/// Now testing A=row, B=col, C=row ///" << std::endl;
851 std::cout <<
"///////////////////////////////////////" << std::endl;
852 ret = test_prod<NumericT, viennacl::row_major, viennacl::column_major, viennacl::row_major>(epsilon);
853 if (ret != EXIT_SUCCESS)
856 std::cout <<
"///////////////////////////////////////" << std::endl;
857 std::cout <<
"/// Now testing A=row, B=col, C=col ///" << std::endl;
858 std::cout <<
"///////////////////////////////////////" << std::endl;
859 ret = test_prod<NumericT, viennacl::row_major, viennacl::column_major, viennacl::column_major>(epsilon);
860 if (ret != EXIT_SUCCESS)
863 std::cout <<
"///////////////////////////////////////" << std::endl;
864 std::cout <<
"/// Now testing A=col, B=row, C=row ///" << std::endl;
865 std::cout <<
"///////////////////////////////////////" << std::endl;
866 ret = test_prod<NumericT, viennacl::column_major, viennacl::row_major, viennacl::row_major>(epsilon);
867 if (ret != EXIT_SUCCESS)
870 std::cout <<
"///////////////////////////////////////" << std::endl;
871 std::cout <<
"/// Now testing A=col, B=row, C=col ///" << std::endl;
872 std::cout <<
"///////////////////////////////////////" << std::endl;
873 ret = test_prod<NumericT, viennacl::column_major, viennacl::row_major, viennacl::column_major>(epsilon);
874 if (ret != EXIT_SUCCESS)
877 std::cout <<
"///////////////////////////////////////" << std::endl;
878 std::cout <<
"/// Now testing A=col, B=col, C=row ///" << std::endl;
879 std::cout <<
"///////////////////////////////////////" << std::endl;
880 ret = test_prod<NumericT, viennacl::column_major, viennacl::column_major, viennacl::row_major>(epsilon);
881 if (ret != EXIT_SUCCESS)
884 std::cout <<
"///////////////////////////////////////" << std::endl;
885 std::cout <<
"/// Now testing A=col, B=col, C=col ///" << std::endl;
886 std::cout <<
"///////////////////////////////////////" << std::endl;
887 ret = test_prod<NumericT, viennacl::column_major, viennacl::column_major, viennacl::column_major>(epsilon);
888 if (ret != EXIT_SUCCESS)
901 std::cout << std::endl;
902 std::cout <<
"----------------------------------------------" << std::endl;
903 std::cout <<
"----------------------------------------------" << std::endl;
904 std::cout <<
"## Test :: BLAS 3 routines" << std::endl;
905 std::cout <<
"----------------------------------------------" << std::endl;
906 std::cout <<
"----------------------------------------------" << std::endl;
907 std::cout << std::endl;
909 int retval = EXIT_SUCCESS;
911 std::cout << std::endl;
912 std::cout <<
"----------------------------------------------" << std::endl;
913 std::cout << std::endl;
915 typedef float NumericT;
916 NumericT epsilon = NumericT(1.0E-3);
917 std::cout <<
"# Testing setup:" << std::endl;
918 std::cout <<
" eps: " << epsilon << std::endl;
919 std::cout <<
" numeric: float" << std::endl;
920 retval = test<NumericT>(epsilon);
921 if ( retval == EXIT_SUCCESS )
922 std::cout <<
"# Test passed" << std::endl;
926 std::cout << std::endl;
927 std::cout <<
"----------------------------------------------" << std::endl;
928 std::cout << std::endl;
929 #ifdef VIENNACL_WITH_OPENCL
934 typedef double NumericT;
935 NumericT epsilon = 1.0E-11;
936 std::cout <<
"# Testing setup:" << std::endl;
937 std::cout <<
" eps: " << epsilon << std::endl;
938 std::cout <<
" numeric: double" << std::endl;
939 retval = test<NumericT>(epsilon);
940 if ( retval == EXIT_SUCCESS )
941 std::cout <<
"# Test passed" << std::endl;
945 std::cout << std::endl;
946 std::cout <<
"----------------------------------------------" << std::endl;
947 std::cout << std::endl;
950 std::cout << std::endl;
951 std::cout <<
"------- Test completed --------" << std::endl;
952 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.
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)
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)
int test_prod(Epsilon const &epsilon, ReferenceMatrixTypeA const &A, ReferenceMatrixTypeA const &A_trans, ReferenceMatrixTypeB const &B, ReferenceMatrixTypeB const &B_trans, ReferenceMatrixTypeC &C, MatrixTypeA const &vcl_A, MatrixTypeA const &vcl_A_trans, MatrixTypeB const &vcl_B, MatrixTypeB const &vcl_B_trans, MatrixTypeC &vcl_C)
iterator begin()
Returns an iterator pointing to the beginning of the vector (STL like)
ScalarType diff(ScalarType &s1, viennacl::scalar< ScalarType > &s2)
bool double_support() const
ViennaCL convenience function: Returns true if the device supports double precision.
void prod(const MatrixT1 &A, bool transposed_A, const MatrixT2 &B, bool transposed_B, MatrixT3 &C, ScalarT alpha, ScalarT beta)
Implementations of dense direct solvers are found here.
Proxy classes for matrices.
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) ...
size_type size() const
Returns the length of the vector (cf. std::vector)
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;'.
int test(Epsilon const &epsilon)
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.
iterator end()
Returns an iterator pointing to the end of the vector (STL like)
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Implementation of the ViennaCL scalar class.