The cvx suite for MATLAB can solve the (seemingly innocent) optimization problem below, but it is rather slow for the large, full matrices I'm working with. I'm hoping this is because using cvx is overkill, and that the problem actually has an analytic solution, or that a clever use of some built-in MATLAB functions can more quickly do the job.
Background: It is well-known that both x1=A\b
and x2=pinv(A)*b
solve the least-squares problem:
minimize norm(A*x-b)
with the distinction that norm(x2)<=norm(x1)
. In fact, x2
is the minimum-norm solution to the problem, so norm(x2)<=norm(x)
for all possible solutions x
.
Defining D=norm(A*x2-b)
, (equivalently D=norm(A*x1-b)
), then x2
solves the problem
minimize norm(x)
subject to
norm(A*x-b) == D
Problem: I'd like to find the solution to:
minimize norm(x)
subject to
norm(A*x-b) <= D+threshold
In words, I don't need norm(A*x-b)
to be as small as possible, just within a certain tolerance. I want the minimum-norm solution x
that gets A*x
within D+threshold
of b
.
I haven't been able to find an analytic solution to the problem (like using the pseudoinverse in the classic least-squares problem) on the web or by hand. I've been searching things like "least squares with nonlinear constraint" and "least squares with threshold".
Any insights would be greatly appreciated, but I suppose my real question is: What is the fastest way to solve this "thresholded" least-squares problem in MATLAB?