eLynx SDK
v3.3.0 C++ image processing API reference |
Least squares problems solver. More...
#include <LeastSquares.h>
Static Public Member Functions | |
static void | Solve (const IMatrix &iA, const IVector &iB, IVector &oX, double iTau=1e-9) |
Solves given least squares problems using HFTI method. |
Least squares problems solver.
The class implements HFTI method to solve overdetermined least squares problems using Householder transformations. The method is taken from 'Solving Least Squares Problems' by Charles L. Lawson and Richard J. Hanson. Author of this code does not pretend he understands how the method works :-). He is happy enough with the fact he is able to implement the algorithm, to create inputs and to understand the outputs. The problem is described by the set of M linear equations with N variables, where M is typically greater than N. The system of linear equations is represented (as usual) by the M x N matrix A (the matrix of the coefficients) and the M-size vector B (the vector of the right sides). The solution is N-size vector X, while euclidean length ||A*X-B|| is minimized. The method is able to deal with possible problems like linear dependency between rows of the matrix A (even when the problem is caused by floating point precision deficiency).
static void eLynx::Math::LeastSquares::Solve | ( | const IMatrix & | iA, |
const IVector & | iB, | ||
IVector & | oX, | ||
double | iTau = 1e-9 |
||
) | [static] |
Solves given least squares problems using HFTI method.
The input is the system of linear equations Ax=B and the floating point precision constant tau - numbers, whose absolute value is less than tau are considered to be zero. The output is vector X (solution of the problem).
iA | the M x N matrix of coefficients of the system of linear equations |
iB | the M-size vector of the right sides of the system of linear equations |
oX | the N-size vector, where the solution will be stored |
iTau | the floating point precision constant |