40 #include <boost/numeric/ublas/io.hpp>
41 #include <boost/numeric/ublas/triangular.hpp>
42 #include <boost/numeric/ublas/matrix_sparse.hpp>
43 #include <boost/numeric/ublas/matrix.hpp>
44 #include <boost/numeric/ublas/matrix_proxy.hpp>
45 #include <boost/numeric/ublas/operation.hpp>
46 #include <boost/numeric/ublas/operation_sparse.hpp>
47 #include <boost/numeric/ublas/io.hpp>
48 #include <boost/numeric/ublas/lu.hpp>
51 #define VIENNACL_WITH_UBLAS 1
69 using namespace boost::numeric;
81 ublas::vector<ScalarType> rhs;
82 ublas::vector<ScalarType> ref_result;
83 ublas::vector<ScalarType> result;
84 ublas::compressed_matrix<ScalarType> ublas_matrix;
91 std::cout <<
"Error reading Matrix file" << std::endl;
100 std::cout <<
"Error reading RHS file" << std::endl;
107 std::cout <<
"Error reading Result file" << std::endl;
124 std::cout <<
"----- CG Test -----" << std::endl;
127 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
129 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
131 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
133 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
138 std::cout <<
"----- BiCGStab Test -----" << std::endl;
147 std::cout <<
"----- GMRES Test -----" << std::endl;
156 std::cout <<
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
T norm_2(std::vector< T, A > const &v1)
A reader and writer for the matrix market format is implemented here.
ILU0 preconditioner class, can be supplied to solve()-routines.
A tag for incomplete LU factorization with static pattern (ILU0)
The stabilized bi-conjugate gradient method is implemented here.
A block ILU preconditioner class, can be supplied to solve()-routines.
A tag for the solver GMRES. Used for supplying solver parameters and for dispatching the solve() func...
Implementations of the generalized minimum residual method are in this file.
Implementations of incomplete factorization preconditioners. Convenience header file.
A tag for incomplete LU factorization with threshold (ILUT)
bool readVectorFromFile(const std::string &filename, VectorType &vec)
ILUT preconditioner class, can be supplied to solve()-routines.
The conjugate gradient method is implemented here.
void prod(const MatrixT1 &A, bool transposed_A, const MatrixT2 &B, bool transposed_B, MatrixT3 &C, ScalarT alpha, ScalarT beta)
A tag for the conjugate gradient Used for supplying solver parameters and for dispatching the solve()...
A tag for the stabilized Bi-conjugate gradient solver. Used for supplying solver parameters and for d...
long read_matrix_market_file(MatrixT &mat, const char *file, long index_base=1)
Reads a sparse matrix from a file (MatrixMarket format)
viennacl::vector< NumericT > solve(MatrixT const &A, viennacl::vector_base< NumericT > const &rhs, bicgstab_tag const &tag, viennacl::linalg::no_precond)
Implementation of a pipelined stabilized Bi-conjugate gradient solver.