|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectNonNegativeLeastSquares
public class NonNegativeLeastSquares
Class NonNegativeLeastSquares provides a method for solving a least squares minimization problem with nonnegativity constraints. The solve() method finds an approximate solution to the linear system of equations Ax = b, such that ||Ax - b||2 is minimized, and such that x >= 0. The inputs to and outputs from the solve() method are stored in the fields of an instance of class NonNegativeLeastSquares.
The Java code is a translation of the Fortran subroutine NNLS from Charles L. Lawson and Richard J. Hanson, Solving Least Squares Problems (Society for Industrial and Applied Mathematics, 1995), page 161.
| Field Summary | |
|---|---|
double[][] |
a
The MxN-element A matrix for the least squares problem. |
double[] |
b
The M-element b vector for the least squares problem. |
int[] |
index
The N-element index vector. |
int |
M
The number of rows, typically the number of input data points, in the least squares problem. |
int |
N
The number of columns, typically the number of output parameters, in the least squares problem. |
double |
normsqr
The squared Euclidean norm of the residual vector, ||Ax - b||2. |
int |
nsetp
The number of elements in the set P; that is, the number of positive values (inactive constraints). |
double[] |
x
The N-element x vector for the least squares problem. |
| Constructor Summary | |
|---|---|
NonNegativeLeastSquares(int M,
int N)
Construct a new nonnegative least squares problem of the given size. |
|
| Method Summary | |
|---|---|
void |
solve()
Solve this least squares minimization problem with nonnegativity constraints. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final int M
public final int N
public final double[][] a
public final double[] b
public final double[] x
public final int[] index
public int nsetp
public double normsqr
| Constructor Detail |
|---|
public NonNegativeLeastSquares(int M,
int N)
M - Number of rows (input data points) in the least squares
problem.N - Number of columns (output parameters) in the least squares
problem.
IllegalArgumentException - (unchecked exception) Thrown if M <= 0 or N
<= 0.| Method Detail |
|---|
public void solve()
IllegalStateException - (unchecked exception) Thrown if too many iterations occurred without
finding a minimum (more than 3N iterations).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||