#include <cmath>
#include "scppnt/scppnt.h"
#include "scppnt/scppnt_error.h"
Go to the source code of this file.
Namespaces | |
namespace | SCPPNT |
Functions | |
template<class MaTRiX, class VecToRSubscript> | |
int | SCPPNT::LU_factor (MaTRiX &A, VecToRSubscript &indx) |
Right-looking LU factorization algorithm (unblocked). | |
template<class MaTRiX, class VecToR, class VecToRSubscripts> | |
int | SCPPNT::LU_solve (const MaTRiX &A, const VecToRSubscripts &indx, VecToR &b) |
Solve system of linear equations using LU factorization computed from LU_factor. |
Definition of functions LU_factor and LU_solve for solving system of linear equations Ax = b.
Typical usage:
Matrix<double> A; Vector<Subscript> ipiv; Vector<double> b;
LU_Factor(A,ipiv); LU_Solve(A,ipiv,b);
Now b has the solution x. Note that both A and b are overwritten. If these values need to be preserved, one can make temporary copies, as in
Matrix<double> T = A; LU_Factor(T,ipiv); Vector<double> x=b; LU_Solve(T,ipiv,x);
Contains modified version of the functions in lu.h from the Template Numerical Toolkit (TNT) using matrix iterators rather than matrix subscripting.
Definition in file lu.h.