31 #include <boost/numeric/mtl/mtl.hpp>
32 #include <boost/numeric/itl/itl.hpp>
35 #define VIENNACL_WITH_MTL4 1
52 int main(
int,
char *[])
56 mtl::compressed2D<ScalarType> mtl4_matrix;
57 mtl4_matrix.change_dim(65025, 65025);
58 set_to_zero(mtl4_matrix);
60 mtl::dense_vector<ScalarType> mtl4_rhs(65025, 1.0);
61 mtl::dense_vector<ScalarType> mtl4_result(65025, 0.0);
62 mtl::dense_vector<ScalarType> mtl4_residual(65025, 0.0);
68 mtl::io::matrix_market_istream(
"../examples/testdata/mat65k.mtx") >> mtl4_matrix;
73 std::cout <<
"----- Running CG -----" << std::endl;
76 mtl4_residual = mtl4_matrix * mtl4_result - mtl4_rhs;
82 std::cout <<
"----- Running BiCGStab -----" << std::endl;
85 mtl4_residual = mtl4_matrix * mtl4_result - mtl4_rhs;
91 std::cout <<
"----- Running GMRES -----" << std::endl;
94 mtl4_residual = mtl4_matrix * mtl4_result - mtl4_rhs;
100 std::cout << std::endl;
101 std::cout <<
"!!!! TUTORIAL COMPLETED SUCCESSFULLY !!!!" << std::endl;
102 std::cout << std::endl;
T norm_2(std::vector< T, A > const &v1)
A reader and writer for the matrix market format is implemented here.
The stabilized bi-conjugate gradient method is implemented here.
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.
The conjugate gradient method is implemented here.
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...