CEPS  24.01
Cardiac ElectroPhysiology Simulator
EigenTools.hpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
37 #pragma once
38 
43 #include <Eigen/Dense>
44 
46 
47 namespace ceps
48 {
49  // copy from FEAssembler
51  // using DofMatrix = CepsMathDynamic2D;
53  // using DofVector = CepsMathDynamic1D;
57  // using Vertex = Eigen::Matrix<CepsReal, 3, 1>;
59  // using DofScalars = CepsMathDynamic1D;
64 
65  namespace math
66  {
67 
76  void
78 
87  void
88  computeInverse (const Eigen::Matrix<CepsReal, 3, 2> &m, Eigen::Matrix<CepsReal, 2, 3> &inv);
89 
98  void
99  computeInverse (const Eigen::Matrix<CepsReal, 3, 1> &m, Eigen::Matrix<CepsReal, 1, 3> &inv);
100 
109  void
110  computeInverse (const Eigen::Matrix<CepsReal, 2, 1> &m, Eigen::Matrix<CepsReal, 1, 2> &inv);
111 
131 
139 
147  void
149 
161  const CepsMathDynamic2D& A,
162  const CepsMathDynamic2D& B,
163  const CepsArray2<CepsUInt> a,
164  const CepsArray2<CepsUInt> b
165  );
166 
167 // see topLeftCorner implemented method in Eigen library (old version ?)
168  // /// @brief Block extraction (C/C from Eigen wiki)
169  // template <typename Derived>
170  // Eigen::Block<Derived>
171  // topLeftCorner (Eigen::MatrixBase<Derived> &m, int rows, int cols)
172  // {
173  // return Eigen::Block<Derived> (m.derived (), 0, 0, rows, cols);
174  // }
175 
176  // /// @brief Block extraction (C/C from Eigen wiki)
177  // template <typename Derived>
178  // const Eigen::Block<const Derived> &
179  // topLeftCorner (const Eigen::MatrixBase<Derived> &m, int rows, int cols)
180  // {
181  // return Eigen::Block<const Derived> (m.derived (), 0, 0, rows, cols);
182  // }
183 
184  } // namespace math
185 } // namespace ceps
Eigen::Matrix< CepsScalar, Eigen::Dynamic, 1 > CepsMathDynamic1D
Dynamic 1D array, eigen format.
Definition: CepsTypes.hpp:139
CepsArray< _Type, 2U > CepsArray2
C++ array, 2 elements.
Definition: CepsTypes.hpp:162
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
Eigen::Matrix< CepsScalar, Eigen::Dynamic, Eigen::Dynamic > CepsMathDynamic2D
Dynamic 2D array, eigen format.
Definition: CepsTypes.hpp:140
void computeInverse(const CepsMathDynamic2D &m, CepsMathDynamic2D &inv)
Inverse of square matrices.
Definition: EigenTools.cpp:42
CepsMathDynamic2D compose(CepsUInt M, CepsVector< CepsMathDynamic2D * > blocks)
Bloc matrices interleaving.
Definition: EigenTools.cpp:97
CepsMathDynamic2D multiplyByBlocks(const CepsMathDynamic2D &A, const CepsMathDynamic2D &B, const CepsArray2< CepsUInt > a, const CepsArray2< CepsUInt > b)
Compute a matrix product by blocks [[C_11, C_12], [C_21, C_22]] = [[A_11 * B_11, A_12 * B_12],...
Definition: EigenTools.cpp:184
void putRowsSumInDiagonal(CepsMathDynamic2D &mat)
Mass lumping.
Definition: EigenTools.cpp:163
A namespace for all utility methods.