I need to solve an equation AX = B using Python where A, X, B are matrices and all values of X must be non-negative.
The best solution I've found is
X = np.linalg.lstsq(A, B, rcond=None)
but as a result X contains negative values. Is it possible to get a solution without negative values? Thanks in advance!
Bhas to be one-dimensional withscipy.optimize.lsq_linearandscipy.optimize.nnlsunfortunately.np.linalg.lstsqalready does.