PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
Eigen_LUSolver.hpp
Go to the documentation of this file.
1// _LICENSE_HEADER_
2//
3// Copyright (C) 2019 - 2025.
4// Terms register on the GPL-3.0 license.
5//
6// This file can be redistributed and/or modified under the license terms.
7//
8// See top level LICENSE file for more details.
9//
10// This file can be used citing references in CITATION.cff file.
11
12#ifndef __EIGENLUSOLVER_H
13#define __EIGENLUSOLVER_H
14
15#include "Eigen/Eigen"
16#include "ILinearSolver.hpp"
17
18namespace Gedim
19{
21template <typename Eigen_ArrayType = Eigen::VectorXd, typename Eigen_SparseArrayType = Eigen::SparseMatrix<double>>
23{
24 private:
25 Eigen::SparseLU<Eigen_SparseArrayType> linearSolver;
26 const IArray *_rightHandSide;
27 IArray *_solution;
28
29 public:
31 {
32 _rightHandSide = nullptr;
33 _solution = nullptr;
34 }
36 {
37 _rightHandSide = nullptr;
38 _solution = nullptr;
39 }
40
41 void Initialize(const ISparseArray &matrix, const IArray &rightHandSide, IArray &solution, const Configuration &config = Configuration());
42
43 void Initialize(const IArray &rightHandSide, IArray &solution, const Configuration &config = Configuration());
44
45 SolutionInfo Solve() const;
46
47 void Initialize(const ISparseArray &matrix, const Configuration &config = Configuration());
48
49 SolutionInfo Solve(const IArray &rightHandSide, IArray &solution) const;
50};
51} // namespace Gedim
52
53#endif // __EIGENLUSOLVER_H
Eigen column vector.
Definition Eigen_Array.hpp:23
Eigen LU Linear solver.
Definition Eigen_LUSolver.hpp:23
SolutionInfo Solve() const
Compute the solution.
Definition Eigen_LUSolver.cpp:44
Eigen_LUSolver()
Definition Eigen_LUSolver.hpp:30
~Eigen_LUSolver()
Definition Eigen_LUSolver.hpp:35
void Initialize(const ISparseArray &matrix, const IArray &rightHandSide, IArray &solution, const Configuration &config=Configuration())
Initialize the linear solver Ax = b.
Definition Eigen_LUSolver.cpp:25
Interface used for column double Array.
Definition IArray.hpp:23
Interface used for algebra linear solvers.
Definition ILinearSolver.hpp:22
Interface used for sparse Array of double.
Definition ISparseArray.hpp:25
Definition Eigen_Array.cpp:22