I have a library that can solve minimize{||Ax-b||}
(Linear least squares).
A
is a matrix, whilex
andb
is a vector.- It is possible that
A
is not invertible. A
is not a square matrix.
Now, I want to solve it with additional constraints : all xi>0
.
Question
How to adapt/encapsulate the solver to support constraints all xi>0
?
I prefer to think that the existing library is a blackbox function - solve(A,b,x)
.
I want to encapsulate it to be solvePositive(A,b,x)
.
For an answer, I expect rough idea, i.e. it doesn't need to contain any code at all.
Edit: .... or should I write a new algorithm instead?
If so, what are the names of applicable algorithms?
I seek for a beginner-friendly guide.
My search
An answer in SO describes something around LSQR.
An answer at math stackexchange describes how to do it, but with Lagrangian style. It is a wonderland for me.
The 3rd post in Eigen library's forum offer a code, but I don't find description how the algorithm works.