SourcePro® 2024.1 |
SourcePro® API Reference Guide |
A templatized LU factorization class that holds the LU factorization of a general square matrix of type T. More...
#include <rw/math/genfact.h>
Public Types | |
typedef rw_numeric_traits< T >::norm_type | norm_type |
Public Member Functions | |
RWGenFact () | |
RWGenFact (const RWGenFact< T > &A) | |
RWGenFact (const RWGenMat< T > &A, bool estimateCondition=true) | |
norm_type | condition () const |
void | factor (const RWGenMat< T > &A, bool estimateCondition=true) |
bool | fail () const |
bool | good () const |
bool | isSingular () const |
Related Symbols | |
(Note that these are not member symbols.) | |
template<class T > | |
double | condition (const RWGenFact< T > &A) |
template<class T > | |
double | condition (const RWGenMat< T > &A) |
template<class T > | |
T | determinant (const RWGenFact< T > &A) |
template<class T > | |
RWGenMat< T > | inverse (const RWGenFact< T > &A) |
template<class T > | |
RWGenMat< T > | inverse (const RWGenMat< T > &A) |
template<class T > | |
RWGenMat< T > | solve (const RWGenFact< T > &m, const RWGenMat< T > &b) |
template<class T > | |
RWMathVec< T > | solve (const RWGenFact< T > &m, const RWMathVec< T > &b) |
template<class T > | |
RWGenMat< T > | solve (const RWGenMat< T > &A, const RWGenMat< T > &b) |
template<class T > | |
RWMathVec< T > | solve (const RWGenMat< T > &A, const RWMathVec< T > &b) |
Class RWGenFact is a templatized LU factorization class. This class holds the LU factorization of a general square matrix of type T. Once such a factorization is built, it can be used to invert a matrix, calculate its determinant, or solve a set of simultaneous linear equations.
Optionally, a condition number can be calculated and then recovered via member function condition(), which returns the reciprocal of the standard definition for the condition number of a matrix.
The result is in the range [0,1]. The closer the result is to 0, the closer the matrix is to being singular. See Dongarra et al. (1979) for additional information.
typedef rw_numeric_traits<T>::norm_type RWGenFact< T >::norm_type |
This is a convenience typedef. The condition numbers have type dependent on the traits class.
RWGenFact< T >::RWGenFact | ( | ) |
Sets up an empty LU factorization. Member function factor() can then be used to actually calculate the factorization.
RWGenFact< T >::RWGenFact | ( | const RWGenFact< T > & | A | ) |
Copy constructor. Reference semantics are used; that is, a shallow copy of the argument is made.
RWGenFact< T >::RWGenFact | ( | const RWGenMat< T > & | A, |
bool | estimateCondition = true ) |
Constructs an LU factorization from the matrix m. If the argument estimateCondition is true
, a condition number is also calculated. Setting estimateCondition to false
saves some time (perhaps 20%), but gives you less information about how ill-conditioned the matrix is. If the matrix m is not square, an exception with value RWLAPK_NOTSQUARE
occurs. This constructor also serves as a type conversion from RWGenMat to RWGenFact
An exception with value RWMATH_NOCONDITION
occurs if the condition number is not calculated.
void RWGenFact< T >::factor | ( | const RWGenMat< T > & | A, |
bool | estimateCondition = true ) |
Recalculates the factorization, this time using the matrix m. If the argument estimateCondition is true
, a condition number is also calculated.
bool RWGenFact< T >::fail | ( | ) | const |
Returns true
if the factorization fails, perhaps due to singularity, otherwise returns false
.
|
inline |
Returns true
if the factorization succeeds.
bool RWGenFact< T >::isSingular | ( | ) | const |
Checks to see if the matrix is singular. If isSingular() returns a non-zero value, the matrix is singular. Note that the LU factorization is still defined; however, an attempt to use it to compute the matrix inverse fails.
|
related |
Returns the inverse condition number of the matrix whose LU factorization is A.
|
related |
Returns the inverse condition number of matrix A
|
related |
Returns the determinant of the matrix from which an LU factorization A is constructed.
Returns the inverse of the matrix from which an existing LU factorization was constructed. If the factorization A is invalid, perhaps because the original matrix was singular, an exception with value LPAK_CANTSOLVE
occurs.
Returns the inverse of the matrix from which an existing LU factorization was constructed. If the factorization of A is invalid, perhaps because the original matrix was singular, an exception with value LPAK_CANTSOLVE
occurs.
|
related |
Calculates the solution to \( A*x = b \), where b is an LU factorization constructed from the RWGenMat A.
If the factorization m is invalid, perhaps because the original matrix A was singular, an exception with value LPAK_CANTSOLVE
occurs. If the number of elements in x does not match the order of A, an exception with value LPAK_VECLENGTH
occurs.
|
related |
Calculates the solution to \( A*x = b \), where m is an LU factorization constructed from the RWGenMat A
.
If the factorization m is invalid, perhaps because the original matrix A was singular, an exception with value LPAK_CANTSOLVE
occurs. If the number of elements in x does not match the order of A, an exception with value LPAK_VECLENGTH
occurs.
Calculates the solution to \( A*x = b \).
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |