Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
LU.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // Reaktoro includes
21 #include <Reaktoro/Common/Index.hpp>
22 #include <Reaktoro/Common/Matrix.hpp>
23 
24 namespace Reaktoro {
25 
27 struct LU
28 {
30  LU();
31 
33  explicit LU(MatrixXdConstRef A);
34 
37 
39  auto empty() const -> bool;
40 
42  auto compute(MatrixXdConstRef A) -> void;
43 
46 
49 
52 
55 
58 
61 
64 
67 
70 
73 };
74 
75 } // namespace Reaktoro
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
Eigen::MatrixXd MatrixXd
Convenient alias to Eigen type.
Definition: Matrix.hpp:137
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
Eigen::Ref< const VectorXd > VectorXdConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:76
Eigen::VectorXd VectorXd
Convenient alias to Eigen type.
Definition: Matrix.hpp:74
Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > PermutationMatrix
Define an alias to a permutation matrix type of the Eigen library.
Definition: Matrix.hpp:170
Eigen::Ref< const MatrixXd > MatrixXdConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:139
The class that computes the full pivoting Auxiliary struct for storing the LU decomposition of a matr...
Definition: LU.hpp:28
LU()
Construct a default LU instance.
Index rank
The rank of the matrix A
Definition: LU.hpp:72
MatrixXd L
The lower triangular matrix L in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:60
auto solve(MatrixXdConstRef b) -> MatrixXd
Solve the linear system AX = B using the calculated LU decomposition.
auto trsolve(MatrixXdConstRef B) -> MatrixXd
Solve the linear system tr(A)X = B using the calculated LU decomposition.
auto empty() const -> bool
Return true if empty.
MatrixXd A_last
The last decomposed matrix A.
Definition: LU.hpp:54
LU(MatrixXdConstRef A, VectorXdConstRef W)
Construct a LU instance with given matrix and scaling column-weights.
MatrixXd U
The upper triangular matrix U in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:63
PermutationMatrix P
The permutation matrix P in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:66
VectorXd W_last
The last weights used for column scaling.
Definition: LU.hpp:57
auto compute(MatrixXdConstRef A) -> void
Compute the LU decomposition of the given matrix.
PermutationMatrix Q
The permutation matrix Q in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:69
LU(MatrixXdConstRef A)
Construct a LU instance with given matrix.