|
|
Algorithm NNLS (Non-negative least-squares)
Given an m by n matrix A, and an m-vector B, computes an n-vector X, that solves the least squares problem A * X = B , subject to X>=0
Instead of pointers for working space, NULL can be given to let this function to allocate and free the required memory.
- Returns:
- Function returns 0 if succesful, 1, if iteration count exceeded 3*N, or 2 in case of invalid problem dimensions or memory allocation error.
- Parameters:
-
| a |
On entry, a[n][m] contains the m by n matrix A. On exit, a[][] contains the product matrix Q*A, where Q is an m by n orthogonal matrix generated implicitly by this function. |
| m |
Matrix dimension m |
| n |
Matrix dimension n |
| b |
On entry, b[] must contain the m-vector B. On exit, b[] contains Q*B |
| x |
On exit, x[] will contain the solution vector |
| rnorm |
On exit, rnorm contains the Euclidean norm of the residual vector |
| wp |
An n-array of working space, w[]. On exit, w[] will contain the dual solution vector. w[i]=0.0 for all i in set p and w[i]<=0.0 for all i in set z. |
| zzp |
An m-array of working space, zz[]. |
| indexp |
An n-array of working space, index[]. |
|