27 #define VIENNACL_WITH_UBLAS
40 #include "boost/numeric/ublas/vector.hpp"
41 #include "boost/numeric/ublas/vector_proxy.hpp"
42 #include "boost/numeric/ublas/io.hpp"
48 int main (
int,
const char **)
53 typedef boost::numeric::ublas::vector<ScalarType> VectorType;
56 std::size_t dim_large = 7;
57 std::size_t dim_small = 3;
62 VectorType ublas_v1(dim_large);
63 VectorType ublas_v2(dim_small);
65 for (std::size_t i=0; i<ublas_v1.size(); ++i)
68 for (std::size_t i=0; i<ublas_v2.size(); ++i)
78 boost::numeric::ublas::vector_range<VectorType> ublas_v1_sub1(ublas_v1, ublas_r1);
79 boost::numeric::ublas::vector_range<VectorType> ublas_v1_sub2(ublas_v1, ublas_r2);
80 boost::numeric::ublas::vector_range<VectorType> ublas_v1_sub3(ublas_v1, ublas_r3);
86 VCLVectorType vcl_v1(dim_large);
87 VCLVectorType vcl_v2(dim_small);
107 ublas_v1_sub1 = ublas_v2;
115 ublas_v1_sub1 += ublas_v1_sub1;
116 vcl_v1_sub1 += vcl_v1_sub1;
118 ublas_v1_sub2 += ublas_v1_sub2;
119 vcl_v1_sub2 += vcl_v1_sub2;
121 ublas_v1_sub3 += ublas_v1_sub3;
122 vcl_v1_sub3 += vcl_v1_sub3;
127 std::cout <<
"ublas: " << ublas_v1 << std::endl;
128 std::cout <<
"ViennaCL: " << vcl_v1 << std::endl;
133 std::cout <<
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class.
Class for representing non-strided subvectors of a bigger vector x.
Proxy classes for vectors.
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.
Implementation of the ViennaCL scalar class.