39 for (
size_t k = 0; k <
LU.
cols(); ++k) {
125 double pivot =
LU(k, k);
128 for (
size_t i = k + 1; i <
LU.
rows(); ++i)
146 for (
size_t c = k + 1; c <
LU.
cols(); ++c)
148 for (
size_t i = k + 1; i <
LU.
rows(); ++i)
150 LU(i, c) -=
LU(i, k) *
LU(k, c);
189 for (
size_t i = 0; i < B.
cols(); ++i) {
190 for (
size_t r =
LU.
rows(); r-- > 0;) {
192 for (
size_t c = r + 1; c <
LU.
cols(); ++c)
193 X(r, i) -=
LU(r, c) * X(c, i);
223 for (
size_t i = 0; i < B.
cols(); ++i) {
224 for (
size_t r = 0; r <
LU.
rows(); ++r) {
226 for (
size_t c = 0; c < r; ++c)
227 X(r, i) -=
LU(r, c) * X(c, i);
size_t rows() const
Get the number of rows of the matrix.
size_t cols() const
Get the number of columns of the matrix.
SquareMatrix LU
Result of a LU factorization: stores the upper-triangular matrix U and the strict lower-triangular pa...
void back_subs(const Matrix &B, Matrix &X) const
Back substitution algorithm for solving upper-triangular systems UX = B.
void solve_inplace(Matrix &B) const
Solve the system AX = B or LUX = B.
bool is_factored() const
Check if this object contains a factorization.
void forward_subs(const Matrix &B, Matrix &X) const
Forward substitution algorithm for solving lower-triangular systems LX = B.
void compute_factorization()
The actual LU factorization algorithm.
enum NoPivotLU::State state