public class NNLS
extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NNLS.Workspace |
Constructor and Description |
---|
NNLS() |
Modifier and Type | Method and Description |
---|---|
static NNLS.Workspace |
createWorkspace(int n) |
static double[] |
solve(org.jblas.DoubleMatrix ata,
org.jblas.DoubleMatrix atb,
NNLS.Workspace ws)
Solve a least squares problem, possibly with nonnegativity constraints, by a modified
projected gradient method.
|
public static NNLS.Workspace createWorkspace(int n)
public static double[] solve(org.jblas.DoubleMatrix ata, org.jblas.DoubleMatrix atb, NNLS.Workspace ws)
We solve the problem min_x 1/2 x^T ata x^T - x^T atb subject to x >= 0
The method used is similar to one described by Polyak (B. T. Polyak, The conjugate gradient method in extremal problems, Zh. Vychisl. Mat. Mat. Fiz. 9(4)(1969), pp. 94-112) for bound- constrained nonlinear programming. Polyak unconditionally uses a conjugate gradient direction, however, while this method only uses a conjugate gradient direction if the last iteration did not cause a previously-inactive constraint to become active.