38 #include "boost/numeric/ublas/vector.hpp"
39 #include "boost/numeric/ublas/matrix.hpp"
40 #include "boost/numeric/ublas/matrix_proxy.hpp"
41 #include "boost/numeric/ublas/io.hpp"
56 boost::numeric::ublas::vector<ScalarType> ublas_vec(size);
57 boost::numeric::ublas::matrix<ScalarType> ublas_circulant(size, size);
58 boost::numeric::ublas::matrix<ScalarType> ublas_hankel(size, size);
59 boost::numeric::ublas::matrix<ScalarType> ublas_toeplitz(size, size);
60 boost::numeric::ublas::matrix<ScalarType> ublas_vandermonde(size, size);
62 for (std::size_t i = 0; i <
size; i++)
63 for (std::size_t j = 0; j <
size; j++)
65 ublas_circulant(i,j) =
static_cast<ScalarType
>((i - j +
size) % size);
66 ublas_hankel(i,j) =
static_cast<ScalarType
>((i + j) % (2 * size));
67 ublas_toeplitz(i,j) =
static_cast<ScalarType
>(i) - static_cast<ScalarType>(j);
88 for (std::size_t i = 0; i <
size; i++)
97 std::cout <<
"Circulant matrix before addition: " << vcl_circulant << std::endl << std::endl;
98 vcl_circulant += vcl_circulant;
99 std::cout <<
"Circulant matrix after addition: " << vcl_circulant << std::endl << std::endl;
105 std::cout <<
"Hankel matrix before manipulation: " << vcl_hankel << std::endl << std::endl;
107 std::cout <<
"Hankel matrix after manipulation: " << vcl_hankel << std::endl << std::endl;
109 std::cout <<
"Vandermonde matrix before manipulation: " << vcl_vandermonde << std::endl << std::endl;
111 std::cout <<
"Vandermonde matrix after manipulation: " << vcl_vandermonde << std::endl << std::endl;
116 std::cout <<
"Toeplitz matrix: " << vcl_toeplitz << std::endl;
117 std::cout <<
"Vector: " << vcl_vec << std::endl << std::endl;
119 std::cout <<
"Result of matrix-vector product: " << vcl_result << std::endl << std::endl;
124 std::cout <<
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
A Vandermonde matrix class.
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 hankel_matrix class for efficient manipulation of Hankel matrices. Experimental.
Implementation of the circulant_matrix class for efficient manipulation of circulant matrices...
Implementation of the vandermonde_matrix class for efficient manipulation of Vandermonde matrices...
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 Circulant matrix class.
Implementation of the toeplitz_matrix class for efficient manipulation of Toeplitz matrices...