Add a NNLS solver to unsupported - issue #655

Reference issue

#655 (closed)

What does this implement/fix?

This adds a non-negative least squares (NNLS) solver to unsupported.

The algorithm is the standard active-set algorithm from the text "Solving Least Squares Problems", Charles L. Lawson and Richard J. Hanson. It's also the same algorithm described on the wikipedia page https://en.wikipedia.org/wiki/Non-negative_least_squares (accessed 2022-01-04).

The API is similar to the Sparse Solver concept (i.e. is has compute, solve, and info methods). However, it does not inherit from a Sparse Solver class, because this code applies to dense matrices.

Additional information

The code has a bit of history. I believe it was started by Hannes Matuschek (who opened issue #655 (closed)) in 2014 and that history is visible on his git repo https://github.com/hmatuschek/eigen3-nnls. Based on the contents of that repo, I suspect it began life as an f2c translation from an older FORTRAN program. Between 2018-2022 I'm aware of no work on this solver. Then, at the beginning of 2022, I did some significant refactoring and testing to prepare this PR.

The hmatuschek/eigen3-nnls version has been in use for many years. The main changes relative to that version are:

  • lots more tests
  • refactoring the API to resemble Eigen's other iterative solvers, e.g. the 'compute' and 'solve' and 'info' API.
  • deleting some non-essential and broken parts
Edited by Essex Edwards

Merge request reports

Loading