Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I want to solve $Ax = b$ subject to the constraint that all of the elements of $x$ are non-negative. If such a solution does not exist, I want to find non-negative $x$ such that the quadratic form $(Ax - b)^T (Ax-b)$ is minimized. What kind of algorithm will let me do this?

share|improve this question
    
what are dimensions of matrix $A$? Is it square, more columns than rows or vice versa? –  mpiktas Apr 16 '11 at 18:14

1 Answer 1

up vote 2 down vote accepted

Put differently, you want to solve the following optimization problem $$ \min_x \|Ax-b\|^2\ \text{s. t.}\ x\geq 0. $$ This is a quadratic and convexly constrained minimization problem which can be solved in many ways. There are several software packages around to do the task, for example the quadprog routine of the Matlab Optimization toolbox should work here. However, the choice should at least depend on the size and the type of the matrix.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.