## Non-Negative Least Square

Hello guys,

i am solving this linear system where i need the solution to be positive all the time.

A x = b

Sometimes it is negative, so i need to use non-negative least square for that. Can anyone tell me how non-negative least square works ? how it inforces the non-negativity constraint. Any C++ code would be of great help.

Secondly,

Can i bound negative weights in another way way

x = ( x' - delta )

A x' = b + A delta

where i first solve the equation A x = b. Find how negative the values of x are. Then i accordingly define vector delta and add A times delta to the right hand side to make my solution positive. Is this correct way to get positive x values.

Thanks