Reaktoro 
A unified framework for modeling chemically reactive systems
LU.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2015 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program 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
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. 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/Math/Matrix.hpp>
23 
24 namespace Reaktoro {
25 
27 struct LU
28 {
30  LU();
31 
33  explicit LU(const Matrix& A);
34 
36  LU(const Matrix& A, const Vector& W);
37 
39  auto empty() const -> bool;
40 
42  auto compute(const Matrix& A) -> void;
43 
45  auto compute(const Matrix& A, const Vector& W) -> void;
46 
48  auto solve(const Matrix& b) -> Matrix;
49 
51  auto trsolve(const Matrix& B) -> Matrix;
52 
55 
58 
61 
64 
67 
70 
73 };
74 
75 } // namespace Reaktoro
Eigen::MatrixXd Matrix
Define an alias to the matrix type of the Eigen library.
Definition: Matrix.hpp:387
PermutationMatrix P
The permutation matrix P in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:66
auto empty() const -> bool
Return true if empty.
Definition: LU.cpp:48
Matrix A_last
The last decomposed matrix A.
Definition: LU.hpp:54
LU()
Construct a default LU instance.
Definition: LU.cpp:35
Index rank
The rank of the matrix A
Definition: LU.hpp:72
auto trsolve(const Matrix &B) -> Matrix
Solve the linear system tr(A)X = B using the calculated LU decomposition.
Definition: LU.cpp:136
The class that computes the full pivoting Auxiliary struct for storing the LU decomposition of a matr...
Definition: LU.hpp:27
Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic > PermutationMatrix
Define an alias to a permutation matrix type of the Eigen library.
Definition: Matrix.hpp:390
Eigen::VectorXd Vector
Define an alias to the vector type of the Eigen library.
Definition: Matrix.hpp:384
Matrix U
The upper triangular matrix U in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:63
Vector W_last
The last weights used for column scaling.
Definition: LU.hpp:57
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
Matrix L
The lower triangular matrix L in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:60
auto solve(const Matrix &b) -> Matrix
Solve the linear system AX = B using the calculated LU decomposition.
Definition: LU.cpp:115
PermutationMatrix Q
The permutation matrix Q in the LU decomposition of the matrix PAQ = LU.
Definition: LU.hpp:69
auto compute(const Matrix &A) -> void
Compute the LU decomposition of the given matrix.
Definition: LU.cpp:53
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24