| MF_solve
| MD_solve |
ME_solve |
| MCF_solve |
MCD_solve |
MCE_solve |
|
| Function | solve a linear system |
|
| Syntax C/C++ | #include <MFstd.h>
int MF_solve( fVector X, fMatrix MA, fVector B, unsigned len ); |
| C++ MatObj | #include <OptiVec.h>
void vector<T>::solve( const matrix<T>& MA, const vector<T>& B ); |
| Pascal/Delphi | uses MFstd;
function MF_solve( X:fVector; MA:fMatrix; B:fVector; len:UInt ): IntBool; |
|
| Description | This function solves the system MA * X = B of simultaneous linear equations, using LU decomposition. It works well in all cases where there is one unique solution. If successful, it returns FALSE (0).
If, on the other hand, the system is ill-determined, which happens in all cases where one or more of the equations are linear combinations of other equations of the same system, the resulting matrix becomes singular and the function fails with an error message, returning TRUE (1).
To avoid outright failure in an application where ill-determined matrices might occur, you should use
MF_LUDsetEdit to define a minimum "pivot" for the LU decomposition process. If you do so, MF_solve will always yield a "more or less" meaningful solution and returns always FALSE (0). Then, a call to MF_LUDresult will tell you if pivot-editing has actually been necessary.
Alternatively, you might switch to MF_safeSolve or MF_solveBySVD. |
|
| Return value | FALSE (0), if the linear system could by solved; TRUE (1) in the case of a singular system without pivot-editing |
|
|