Linear Algebra Module User’s Guide : Chapter 4 Factorizations : Calculating the Determinant, Inverse, and Condition Number
Calculating the Determinant, Inverse, and Condition Number
Factorizations are useful for many calculations besides solutions to systems of equations. The Linear Algebra Module factorization classes include member functions for calculating the determinant, condition number, and inverse of a matrix.
Determinants
Calculating the determinant of a matrix is an inexpensive simple process, given its factorization. If F is a float precision factorization, then its determinant can be calculated using:
 
float det = determinant(F);
Matrix Inverses
Matrix inverses are often used in describing matrix algorithms. However, in practice, it is almost never necessary to calculate the inverse of a matrix explicitly. In almost every case, the problem can be solved much more efficiently by using a factorization. Nevertheless, for those rare occasions when you actually need the explicit inverse, a function is provided for its calculation. For example, to find the inverse of a double precision symmetric matrix whose factorization is the variable fact of type RWSymFact<double>, you use:
 
RWSymMat<double> inv = inverse(fact);
Condition Number
The condition number of a matrix describes how sensitive it is to errors in the right-side vector when solving systems of equations. The factorization classes can calculate an estimate of the reciprocal condition number. When this number is near 1, the matrix is said to be well-conditioned. When the reciprocal condition number is near 0, the matrix is ill-conditioned. The solutions obtained for ill-conditioned matrices may not be very accurate. Consult a linear algebra text for more information on conditioning. You compute the condition number like this:
 
double rcond = condition(fact);
To compute the condition, the factorization class must do a little extra work while constructing the factorization; it must compute the norm of the system matrix. If you know that you will not need the condition number, you can save some computation by using the optional bool parameter on the factorization constructor. See the SourcePro C++ API Reference Guide for details.