27 #define BOOST_UBLAS_NDEBUG
36 #define VIENNACL_WITH_UBLAS
50 #include <boost/numeric/ublas/matrix.hpp>
51 #include <boost/numeric/ublas/matrix_proxy.hpp>
52 #include <boost/numeric/ublas/matrix_expression.hpp>
53 #include <boost/numeric/ublas/matrix_sparse.hpp>
54 #include <boost/numeric/ublas/vector.hpp>
55 #include <boost/numeric/ublas/operation.hpp>
56 #include <boost/numeric/ublas/vector_expression.hpp>
70 boost::numeric::ublas::compressed_matrix<ScalarType> ublas_A;
74 std::cout <<
"Error reading Matrix file" << std::endl;
90 std::cout <<
"Starting computation of eigenvalue with largest modulus (might take about a minute)..." << std::endl;
91 std::cout <<
"Result of power iteration with ublas matrix (single-threaded): " <<
viennacl::linalg::eig(ublas_A, ptag) << std::endl;
92 std::cout <<
"Result of power iteration with ViennaCL (OpenCL accelerated): " <<
viennacl::linalg::eig(vcl_A, ptag) << std::endl;
100 std::cout <<
"First three entries in eigenvector: " << eigenvector[0] <<
" " << eigenvector[1] <<
" " << eigenvector[2] << std::endl;
102 std::cout <<
"First three entries in A*eigenvector: " << Ax[0] <<
" " << Ax[1] <<
" " << Ax[2] << std::endl;
A reader and writer for the matrix market format is implemented here.
std::vector< typename viennacl::result_of::cpu_value_type< typename MatrixT::value_type >::type > eig(MatrixT const &matrix, DenseMatrixT &eigenvectors_A, lanczos_tag const &tag, bool compute_eigenvectors=true)
Implementation of the calculation of eigenvalues using lanczos (with and without reorthogonalization)...
A tag for the power iteration algorithm.
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
Implementation of the compressed_matrix class.
Defines a tag for the configuration of the power iteration method.
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.
long read_matrix_market_file(MatrixT &mat, const char *file, long index_base=1)
Reads a sparse matrix from a file (MatrixMarket format)
Implementation of the ViennaCL scalar class.