35#include "arccore/alina/BuiltinBackend.h"
36#include "arccore/alina/Adapters.h"
37#include "arccore/alina/PreconditionedSolver.h"
38#include "arccore/alina/AMG.h"
39#include "arccore/alina/Coarsening.h"
40#include "arccore/alina/Relaxation.h"
41#include "arccore/alina/ConjugateGradientSolver.h"
43#include "arccore/alina/IO.h"
44#include "arccore/alina/Profiler.h"
47using namespace Arcane::Alina;
49int main(
int argc,
char* argv[])
53 std::cerr <<
"Usage: " << argv[0] <<
" <A.mtx> <b.mtx> <coo.mtx>" << std::endl;
60 auto& prof = Alina::Profiler::globalProfiler();
63 ptrdiff_t rows, cols, ndim, ncoo;
64 std::vector<ptrdiff_t> ptr, col;
65 std::vector<double> val, rhs, coo;
73 Alina::precondition(ncoo * ndim == rows && (ndim == 2 || ndim == 3),
74 "The coordinate file has wrong dimensions");
76 std::cout <<
"Matrix " << argv[1] <<
": " << rows <<
"x" << rows << std::endl;
77 std::cout <<
"RHS " << argv[2] <<
": " << rows <<
"x" << cols << std::endl;
78 std::cout <<
"Coords " << argv[3] <<
": " << ncoo <<
"x" << ndim << std::endl;
91 prm.precond.coarsening.aggr.eps_strong = 0;
97 prm.precond.coarsening.nullspace.cols = Alina::rigid_body_modes(ndim, coo, prm.precond.coarsening.nullspace.B);
100 auto A = std::tie(rows, ptr, col, val);
104 Solver solve(context, A, prm);
108 std::cout << solve << std::endl;
111 std::vector<double> x(rows, 0.0);
119 std::cout <<
"Iters: " << r.nbIteration() << std::endl
120 <<
"Error: " << r.residual() << std::endl
121 << prof << std::endl;
Conjugate Gradients solver.
Convenience class that bundles together a preconditioner and an iterative solver.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --