30 #include <boost/numeric/ublas/matrix_sparse.hpp> 
   31 #include <boost/numeric/ublas/matrix.hpp> 
   32 #include <boost/numeric/ublas/operation.hpp> 
   33 #include <boost/numeric/ublas/operation_sparse.hpp> 
   34 #include <boost/numeric/ublas/io.hpp> 
   37 #define VIENNACL_WITH_UBLAS 1 
   50 using namespace boost::numeric;
 
   66   ublas::vector<ScalarType> rhs = ublas::scalar_vector<ScalarType>(
size, 
ScalarType(size));
 
   67   ublas::compressed_matrix<ScalarType> ublas_matrix(size, size);
 
   69   ublas_matrix(0,0) =  2.0f; ublas_matrix(0,1) = -1.0f;
 
   70   ublas_matrix(1,0) = -1.0f; ublas_matrix(1,1) =  2.0f; ublas_matrix(1,2) = -1.0f;
 
   71   ublas_matrix(2,1) = -1.0f; ublas_matrix(2,2) =  2.0f; ublas_matrix(2,3) = -1.0f;
 
   72   ublas_matrix(3,2) = -1.0f; ublas_matrix(3,3) =  2.0f; ublas_matrix(3,4) = -1.0f;
 
   73   ublas_matrix(4,3) = -1.0f; ublas_matrix(4,4) =  2.0f;
 
   75   std::cout << 
"ublas matrix: " << ublas_matrix << std::endl;
 
   87   ublas::compressed_matrix<ScalarType> temp(size, size);
 
   89   std::cout << 
"ViennaCL: " << temp << std::endl;
 
   92   std::cout << 
"Modifying vcl_compressed_matrix a bit: " << std::endl;
 
   93   vcl_compressed_matrix(0, 0) =  3.0f;
 
   94   vcl_compressed_matrix(2, 3) = -3.0f;
 
   95   vcl_compressed_matrix(4, 2) = -3.0f;  
 
   96   vcl_compressed_matrix(4, 3) = -3.0f;
 
  100   std::cout << 
"ViennaCL matrix copied to uBLAS matrix: " << temp << std::endl;
 
  105   std::cout << 
"ublas: " << 
ublas::prod(temp, rhs) << std::endl;
 
  111   std::cout << 
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
 
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
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.) 
Implementation of the compressed_matrix class. 
void prod(std::vector< std::map< IndexT, NumericT > > const &stl_A, std::vector< std::map< IndexT, NumericT > > const &stl_B, std::vector< std::map< IndexT, NumericT > > &stl_C)
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 sparse square matrix in compressed sparse rows format. 
Implementation of the ViennaCL scalar class.