|
|
◆ dgelss()
| void dgelss |
( |
int |
m, |
|
|
int |
n, |
|
|
int |
nrhs, |
|
|
int |
lda, |
|
|
double |
a[], |
|
|
int |
ldb, |
|
|
double |
b[], |
|
|
double |
s[], |
|
|
double |
rcond, |
|
|
int * |
rank, |
|
|
double |
work[], |
|
|
int |
lwork, |
|
|
int * |
info |
|
) |
| |
Solution to overdetermined or underdetermined linear equations Ax = b using the singular value decomposition (SVD)
- Purpose
- This routine computes the minimum norm solution to a real linear least squares problem: using the singular value decomposition (SVD) of A. A is an m x n matrix which may be rank-deficient.
Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the m x nrhs right hand side matrix B and the n x nrhs solution matrix X.
The effective rank of A is determined by treating as zero those singular values which are less than rcond times the largest singular value.
- Parameters
-
| [in] | m | Number of rows of the matrix A. (m >= 0) (If m = 0, returns with rank = 0) |
| [in] | n | Number of columns of the matrix A. (n >= 0) (If n = 0, returns with rank = 0) |
| [in] | nrhs | Number of right hand sides, i.e., number of columns of the matrices B and X. (nrhs >= 0) |
| [in] | lda | Leading dimension of the two dimensional array a[][]. (lda >= max(1, m)) |
| [in,out] | a[][] | Array a[la][lda] (la >= n)
[in] m x n matrix A.
[out] The first min(m, n) rows of a[][] are overwritten with its right singular vectors, stored rowwise. |
| [in] | ldb | Leading dimension of the two dimensional array b[][]. (ldb >= max(1, m, n)) |
| [in,out] | b[][] | Array b[lb][ldb] (lb >= nrhs)
[in] m x nrhs right hand side matrix B.
[out] b[][] is overwritten by the n x nrhs solution matrix X. If m >= n and rank = n, the residual sum of squares for the solution in the i-th column is given by the sum of squares of elements n to m-1 in that column. |
| [out] | s[] | Array s[ls] (ls >= min(m, n))
The singular values of A in decreasing order.
The condition number of A in the 2-norm = s[0]/s[min(m, n)-1]. |
| [in] | rcond | rcond is used to determine the effective rank of A.
Singular values s[i] <= rcond*s[0] are treated as zero. If rcond < 0, machine precision is used instead. |
| [out] | rank | The effective rank of A, i.e., the number of singular values which are greater than rcond*s[0]. |
| [out] | work[] | Array work[lwork]
Work array.
On exit, if info = 0, work[0] returns the optimal lwork. |
| [in] | lwork | The dimension of the array work[]. (lwork >= max(1, 3*min(m, n)+max(2*min(m, n), max(m, n), nrhs)))
For good performance, lwork must generally be larger.
If lwork = -1, then a workspace query is assumed. The routine only calculates the optimal size of the work[] array, and returns the value in work[0]. |
| [out] | info | = 0: Successful exit
= -1: The argument m had an illegal value (m < 0)
= -2: The argument n had an illegal value (n < 0)
= -3: The argument nrhs had an illegal value (nrhs < 0)
= -4: The argument lda had an illegal value (lda < max(1, m))
= -6: The argument ldb had an illegal value (ldb < max(1, m, n))
= -12: The argument lwork had an illegal value (lwork too small)
= i > 0: The algorithm for computing the SVD failed to converge; i off-diagonal elements of an intermediate bidiagonal form did not converge to zero. |
- Reference
- LAPACK
|