# How to solve some problems in TFOCS

I want to solve some problems for imaging. Could you please tell me how to
solve them by TFOCS?

Problem 1. Minimize ||Ax-b||_1^2

is it correct to solve it as follows:

mu = 10;
[x,out] = tfocs_SCD([],{A,-b},prox_linf^2,mu,[],[],opt,[])

if it is not possible to solve this one. how I can solve

Minimize ||Ax-b||_1 ?

for examlpe, can I use

mu = 10;
[x,out] = tfocs_SCD([],{A,-b},prox_linf,mu,[],[],opt,[]) ???

Problem 2. Minimize ||Ax-b||_D^2 + ||x||_1^p

when p >= 1 and ||x||_D = sqrt(x^T D x).

Problem 3. Minimize ||Ax-b||_D^2 + ||Bx||_2^2 + ||x||_2^2 + t^T |x|

wehre t = (t1,t2, …, tn).

Problem 4. ||Ax-b||_2^2 + ||W x||_1
Where W \in R^{m \times n}

I will be happy if someone can istruct

Problem 1. Minimize ||Ax-b||_1^2

is it correct to solve it as follows:

mu = 10; [x,out] = tfocs_SCD([],{A,-b},prox_linf^2,mu,[],[],opt,[])

No, unfortunately the duals don’t work that way: if f and g are conjugates, then f^2 and g^2 are not necessarily conjugates. Also, TFOCS is not smart enough to recognize that prox_linf^2 means you want the prox of linf^2.

if it is not possible to solve this one. how I can solve
Minimize ||Ax-b||_1 ?
for examlpe, can I use
mu = 10; [x,out] = tfocs_SCD([],{A,-b},prox_linf,mu,[],[],opt,[]) ???

Yes, off the top of my head, that looks fine. For problem 1, since there are no other terms, it doesn’t matter if the l1 norm is squared or not, so this should be equivalent to your original problem. (If you do add other terms and really need the l1 norm squared, then first verify that it is convex, and then work out how to compute the proximity operator of the dual)

Problem 2. Minimize ||Ax-b||_D^2 + ||x||_1^p
when p >= 1 and ||x||_D = sqrt(x^T D x).

For this, follow the examples for the LASSO problem that we have in the release and see solver_LASSO.m. To deal with the g(x)=\|Ax-b\|_D^2 term (which is differentiable), you just need to write a small function that calculates its gradient, i.e \nabla_x g(x) = A^TD(Ax-b). Or, use \tilde{A} = D^{1/2}A and \tilde{b} = D^{1/2}b and then run the LASSO solver with these terms. You can use TFOCS.m (you don’t need to use TFOCS_SCD.m) since you can solve the primal problem.

Problem 3. Minimize ||Ax-b||_D^2 + ||Bx||_2^2 + ||x||_2^2 + t^T |x|, wehre t = (t1,t2, …, tn).

The first three terms are all differentiable, so combine these into one function that calculates the gradient. The last term is just a weighted l1 norm term, so use prox_l1(t).

Problem 4. ||Ax-b||_2^2 + ||W x||_1 Where W \in R^{m \times n}

Try modifying solver_sBPDN_W.m for this one.

Thank you so much Stephen for response. I think your comment for problem 1 and 3 is correct and so useful. But for problem 2, do not you think that it can be also handele by [x,out]=tfocs(smooth_quad(D),A,-b},prox_l1(lambda),mu,[],[],opt,[]) ???

Also, for Problem 4, the code solver_sBPDN_W.m stands for constrained version of this problem not unconstrained version. Do you think it can be solved by: [x,out]=tfocs_SCD([],A,-b;},{smooth_quad,prox_linf},mu,[],[],opt,[]) ???

I will be happy if you could answer this two questions.