- LeastSquaresSolution
- LeastSquaresSolutionDC
- LeastSquaresSolutionSVD
- LeastSquaresSolutionWY
- LeastSquaresSolutionsQRPivot
- LeastSquaresSolutionQRTallSkinny
LeastSquaresSolutionDC
Computes the minimum-norm solution to a real or complex linear least squares problem minimize 2-norm(| b - A*x |) using the singular value decomposition (SVD) of A. A is an m-by-n matrix which may be rank-deficient. The divide and conquer algorithm makes very mild assumptions about floating point arithmetic. Lapack function GELSD.
Computing for type matrix<double>
bool matrix::LeastSquaresSolutionDC(
|
Computing for type matrix<float>
bool matrixf::LeastSquaresSolutionDC(
|
Computing for type matrix<complex>
bool matrixc::LeastSquaresSolutionDC(
|
Computing for type matrix<complexf>
bool matrixcf::LeastSquaresSolutionDC(
|
Parameters
B
[in] Matrix B whose columns are the right-hand sides for the systems of equations. Vector B contains one column of right-hand side.
rcond
[in] rcond is used to determine the effective rank of A. Singular values S(i) <= rcond*S(1) are treated as zero. If rcond < 0, machine precision is used instead.
X
[out] Matrix or vector X with solutions of linear least squares problem.
residuals
[out] Matrix or vector with the residual sum of squares for the solution in each column is given by the sum of squares of elements in that column. If m<=n, then residuals matrix(vector) is empty.
singular_values
[out] Vector of computed singular values.
rank
[out] The effective rank of A, i.e., the number of singular values which are greater than rcond*S(1).
Return Value
Return true if successful, otherwise false in case of an error.
Note
Matrix B must be of size m-by-nrhs, where nrhs is number of right-hand side vectors, matrix X is of size n-by-nrhs.
The condition number of A in the 2-norm = S(1)/S(min(m,n)).
The problem is solved in three steps:
Step 1. Reduce the coefficient matrix A to bidiagonal form with Householder transformations, reducing the original problem into a "bidiagonal least squares problem" (BLS).
Step 2. Solve the BLS using a divide and conquer approach.
Step 3. Apply back all the Householder transformations to solve the original least squares problem.