File Exchange

image thumbnail

nnls

version 1.0 (2.29 KB) by

block principal pivoting algorithm

4.66667
3 Ratings

3 Downloads

Updated

No License

solves the linear least squares problem with nonnegative variables using the block principal pivoting algorithm in:
Portugal, Judice and Vicente, A comparison of block pivoting and interior point algorithms for linear least squares problems with nonnegative variables, Mathematics of Computation, 63(1994), pp. 625-643

Comments and Ratings (3)

Greg Reynolds

It works nicely for my matrices of about 1024x20 and is significantly faster than 'lsqnonneg'.

For 100 (random) trials, A is 1024x20, b is 1024x1:
'blocknnls' = 0.686167 seconds
'lsqnonneg' = 5.869711 seconds

John D'Errico

Faster than lsqonneg for some sizes of problems.

Interestingly, my tests show it is slower than lsqnonneg
when the number of unknowns to estimate is small, say 2 or 3 and there are few rows in A. Thus, for size(A) ==
[5,2], lsqnonneg is 3x faster. For size(A) == [100,10],
blocknnls is 3x faster.

Updates

The way the sets F and G are updated in each iteration is corrected.
The permutation of the set is now fixed to avoid different solutions every time the function is used with the same input data. If random required, just uncomment line.

MATLAB Release
MATLAB 7.0.4 (R14SP2)
Acknowledgements

Inspired: LBFGSB (L-BFGS-B) mex wrapper, zeroSR1

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video