This is a Rust version of nnls (Non-Negative Least Square). It's a port from a Fortran90 script used by scipy.optimize.nnls and probablys everal others.
I decided to port nnls to Rust because:
static
variables throughout the code which it unusable in parallel. If you plan to use nnls only in single-thread, you might prefer linkking to that version: it has been heavily tested and has no known problem.nnls
2 times for each voxel. Several of those images has been tested and compared with the original Fortran version.unsafe
and it is forbidden to use any.panic!
in the code because there are 3 code paths in the original code which use goto
that I couldn't translate properly to Rust. I planned to handle those cases but it
turns out that ther are never called. As I wrote, nnls
has been extensively used and I couldn't find any dataset that triggers those conditions. If my programs ever panic because of this, I'll found a solution!