lsqnonneg from the package pracma,
I just changed qr.solve into using Moore-Penrose inverse instead
(ginv from MASS) as qr.solve crashes for
some singular inputs. Now it won't crash but it's sometimes running for very long
time (forever?), presumably with those problematic inputs. After too many steps
the function halts and lies that the fit was terrible. I don't think this will
cause problems.
mynonneg(C, d, iteration_multiplier = 3)x) and the error (resid.norm).
lsqnonneg