#include <Lu.hh>
Public Methods | |
Lu_ (unsigned int N=3) | |
Inits to an N x N problem (default 3). | |
Lu_ (const Rmatdbl_ &A) | |
Inits with the decomposition of the square matrix A. | |
int | decomp (const Rmatdbl_ &A) |
decomp(A): performs an LU-decomposition on the square matrix A. More... | |
double | det () const |
det(): calculates the determinant from the decomposition results stored inside. More... | |
Vecdbl_ | solve (const Vecdbl_ &B) const |
solve(B): solves the linear equation A*x=B and returns x. More... | |
int | lineq (const Rmatdbl_ &A, const Vecdbl_ &B, Vecdbl_ &X, unsigned int Maxit=0) |
lineq(A, B, X, Maxit): solves the nxn linear equation A*X=B and returns X. More... | |
Private Attributes | |
Rmatdbl_ | Lu |
holds the decomposition. | |
vector<unsigned int> | Perm |
permutation vector. | |
int | Psign |
permutation sign. | |
Static Private Attributes | |
const double | LU_EPSILON |
a very small number. |
Can be asked to calculate determinants and solve linear equation systems.
Definition at line 33 of file Lu.hh.
|
Inits to an N x N problem (default 3).
|
|
Inits with the decomposition of the square matrix A.
|
|
decomp(A): performs an LU-decomposition on the square matrix A. Return value: the permutation sign (0 if A was singular). Throws Squarexc_ if A was not NxN. Referenced by Lu_(). |
|
det(): calculates the determinant from the decomposition results stored inside. It is assumed that decomp() has been called beforehand. |
|
solve(B): solves the linear equation A*x=B and returns x. The calling object is supposed to have been primed with decomp(A) before this call. B is the "right-hand-side" vector which is preserved. Throws a Dimexc_ exception if B's dimension does not match A's. |
|
lineq(A, B, X, Maxit): solves the nxn linear equation A*X=B and returns X. Iterative improvement is done a la Num. Recipes (max. Maxit times, default 0). This routine should be used if only one right-hand side vector B is present. For several right-hand sides, use the decomposition and solver routines separately. Return value: 1 means OK, 0 means A was singular. Throws Squarexc_ if A was not NxN, Dimexc_ on dim mismatches. |
|
a very small number.
|
|
holds the decomposition.
|
|
permutation vector.
|
|
permutation sign.
|