Math.h++ provides linear algebra classes to solve sets of simultaneous linear equations via LU factorization for any numeric field type, including double, float, and double precision complex. The requirements for a numeric type to use the linear algebra classes are detailed in Section 2.2.1, "Defining a New Numeric Type." These classes use a templatized version of the Linpack algorithms. (See the reference to Dongarra (1979) in the Bibliography.)
Using these classes is very easy and can even be completely transparent to the user. For example, here is the code to invert a matrix:
#include <rw/math/genfact.h> #include <rw/math/genmat.h> main() { RWGenMat<double> A; cin >> A; // Read in a matrix
// Invert it: RWGenMat<double> Ainv = inverse(A); }
Here is how you would solve a set of linear equations Ax = b, assuming that A has been read in as above:
// Read in the vector b: RWMathVec<double> b; cin >> b;
// "x" will contain the solution: RWMathVec<double> x = solve(A, b);>
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.