23#include "arccore/alina/BuiltinBackend.h"
24#include "arccore/alina/PreconditionedSolver.h"
25#include "arccore/alina/AMG.h"
26#include "arccore/alina/Coarsening.h"
27#include "arccore/alina/Relaxation.h"
28#include "arccore/alina/ConjugateGradientSolver.h"
29#include "arccore/alina/Profiler.h"
37 typedef std::map<int, double> sparse_row;
39 sparse_matrix(
int n,
int m)
45 int nrows()
const {
return _n; }
46 int ncols()
const {
return _m; }
49 double operator()(
int i,
int j)
const
51 sparse_row::const_iterator elem = _rows[i].find(j);
52 return elem == _rows[i].end() ? 0.0 : elem->second;
56 double& operator()(
int i,
int j) {
return _rows[i][j]; }
59 const sparse_row& operator[](
int i)
const {
return _rows[i]; }
64 std::vector<sparse_row> _rows;
67namespace Arcane::Alina::backend
91 int n = A.nrows(), nnz = 0;
92 for (
int i = 0; i < n; ++i)
103 sparse_matrix::sparse_row::const_iterator _it, _end;
106 : _it(A[row].begin())
111 operator bool()
const
117 iterator& operator++()
124 int col()
const {
return _it->first; }
127 double value()
const {
return _it->second; }
135 typedef row_iterator<sparse_matrix>::type iterator;
138 return iterator(A, row);
146 auto& prof = Alina::Profiler::globalProfiler();
151 auto t_total = prof.scoped_tic(
"total");
153 for (
int i = 0; i < n; ++i) {
154 if (i == 0 || i == n - 1) {
176 std::cout << solve.precond() << std::endl;
178 auto t_solve = prof.scoped_tic(
"solve");
179 std::vector<double> f(n, 1.0), x(n, 0.0);
182 std::cout << prof << std::endl;
Algebraic multigrid method.
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 -*-
Non-smoothed aggregation.
Sparse approximate interface smoother.
Implementation for function returning the number of columns in a matrix.
Implementation for function returning the number of nonzeros in a matrix.
Implementation for function returning row iterator for a matrix.
Metafunction returning the row iterator type for a matrix type.
Implementation for function returning the number of rows in a matrix.
Metafunction that returns value type of a matrix or a vector type.