33 #define BOOST_UBLAS_NDEBUG
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
80 ublas::vector<ScalarType> rhs;
81 ublas::vector<ScalarType> ref_result;
82 ublas::vector<ScalarType> result;
83 ublas::compressed_matrix<ScalarType> ublas_matrix;
90 std::cout <<
"Error reading Matrix file" << std::endl;
99 std::cout <<
"Error reading RHS file" << std::endl;
106 std::cout <<
"Error reading Result file" << std::endl;
123 std::cout <<
"----- CG Test -----" << std::endl;
126 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
128 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
130 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
132 std::cout <<
"Residual norm: " <<
norm_2(
prod(ublas_matrix, result) - rhs) << std::endl;
137 std::cout <<
"----- BiCGStab Test -----" << std::endl;
146 std::cout <<
"----- GMRES Test -----" << std::endl;
155 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...
VectorT solve(MatrixT const &matrix, VectorT const &rhs, bicgstab_tag const &tag, PreconditionerT const &precond)
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(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)
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)