Alien  1.3.0
User documentation
Loading...
Searching...
No Matches
SimpleCSRMatrixMult.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7#pragma once
8
9#include <alien/kernels/simple_csr/SimpleCSRMatrix.h>
10#include <alien/kernels/simple_csr/SimpleCSRPrecomp.h>
11#include <alien/kernels/simple_csr/SimpleCSRVector.h>
12
13namespace Alien::SimpleCSRInternal
14{
15
16/*@! Classe amie de SimpleCSRMatrix pour externaliser plus rapidement (mais moins
17 * proprement)
18 * le produit matrice vecteur */
19template <typename ValueT>
21{
22 public:
23 //! Template parameter
24 typedef ValueT ValueType;
25 typedef SimpleCSRMatrix<ValueType> MatrixType;
26 typedef SimpleCSRVector<ValueType> VectorType;
27
28 public:
29 //! Constructeur de la classe
30 SimpleCSRMatrixMultT(const MatrixType& matrix);
31
32 //! Destructeur de la classe
34
35 public:
36 void synchronize(VectorType& x) const;
37
38 //! Matrix vector product
39 void mult(const VectorType& x, VectorType& y) const;
40 void mult(const UniqueArray<Real>& x, UniqueArray<Real>& y) const;
41
42 void addLMult(Real alpha, const VectorType& x, VectorType& y) const;
43 void addUMult(Real alpha, const VectorType& x, VectorType& y) const;
44
45 void lowerUpperSynchronize(const VectorType& x, VectorType& y) const;
46 void upperLowerSynchronize(const VectorType& x, VectorType& y) const;
47
48 void endDistAddLMult(Real alpha, const VectorType& x, VectorType& y) const
49 {
50 _endDistAddLMult(alpha, x, y);
51 }
52
53 void endDistAddUMult(Real alpha, const VectorType& x, VectorType& y) const
54 {
55 _endDistAddUMult(alpha, x, y);
56 }
57
58 void computeDiag(VectorType& y) const;
59 void multDiag(VectorType& y) const;
60 void computeInvDiag(VectorType& y) const;
61 void multInvDiag(VectorType& y) const;
62
63 private:
64 void _synchronize(VectorType& x) const;
65 void _parallelMult(const VectorType& x, VectorType& y) const;
66 void _parallelMult(const UniqueArray<Real>& x, UniqueArray<Real>& y) const;
67
68 void _seqMult(const VectorType& x, VectorType& y) const;
69 void _seqMult(const UniqueArray<Real>& x, UniqueArray<Real>& y) const;
70
71 void _seqAddLMult(Real alpha, const VectorType& x, VectorType& y) const;
72 void _seqAddUMult(Real alpha, const VectorType& x, VectorType& y) const;
73
74 void _endDistAddLMult(Real alpha, const VectorType& x, VectorType& y) const;
75 void _endDistAddUMult(Real alpha, const VectorType& x, VectorType& y) const;
76
77 void _synchronizeBlock(VectorType& x) const;
78 void _parallelMultBlock(const VectorType& x, VectorType& y) const;
79
80 void _seqMultBlock(const VectorType& x, VectorType& y) const;
81
82 void _synchronizeVariableBlock(VectorType& x) const;
83 void _parallelMultVariableBlock(const VectorType& x, VectorType& y) const;
84
85 void _seqMultVariableBlock(const VectorType& x, VectorType& y) const;
86
87 private:
88 const MatrixType& m_matrix_impl;
89};
90
91} // namespace Alien::SimpleCSRInternal
92
93#include "SimpleCSRMatrixMultT.h"
SimpleCSRMatrixMultT(const MatrixType &matrix)
Constructeur de la classe.
void mult(const VectorType &x, VectorType &y) const
Matrix vector product.
virtual ~SimpleCSRMatrixMultT()
Destructeur de la classe.