Mercurial > hg > smallbox
annotate util/small_to_unloc.m @ 244:5c8bcdadb380 unlocbox
added UNLocBox interface, example and a 128x128 Lena
author | bmailhe |
---|---|
date | Tue, 04 Sep 2012 11:00:36 +0100 |
parents | |
children |
rev | line source |
---|---|
bmailhe@244 | 1 function [b2,f1,f2,param] = small_to_unloc(b,A,param) |
bmailhe@244 | 2 |
bmailhe@244 | 3 |
bmailhe@244 | 4 if nargin<3, param=struct; end |
bmailhe@244 | 5 % set parameters |
bmailhe@244 | 6 if ~isfield(param, 'verbose'), param.verbose = 0; end |
bmailhe@244 | 7 if ~isfield(param, 'T'), param.T = 1; end |
bmailhe@244 | 8 if ~isfield(param, 'gamma'), param.gamma = 1/(1.1*norm(A)^2); end |
bmailhe@244 | 9 if ~isfield(param, 'sigma'), param.sigma = 1; end |
bmailhe@244 | 10 |
bmailhe@244 | 11 |
bmailhe@244 | 12 %set function f2 |
bmailhe@244 | 13 param_f2.verbose=param.verbose; |
bmailhe@244 | 14 param_f2.A=@(x) A*x; |
bmailhe@244 | 15 param_f2.At=@(x) A'*x; |
bmailhe@244 | 16 param_f2.y=b; |
bmailhe@244 | 17 param_f2.tight=0; |
bmailhe@244 | 18 param_f2.nu=norm(A,2)^2; |
bmailhe@244 | 19 param_f2.epsilon=param.sigma; |
bmailhe@244 | 20 |
bmailhe@244 | 21 f2.prox= @(x,l) fast_proj_B2(x,l,param_f2); % douglas rachford, admm |
bmailhe@244 | 22 f2.grad= @(x) 2*A'*(A*x-b); %forward backward |
bmailhe@244 | 23 f2.x0=A'*b; |
bmailhe@244 | 24 f2.norm=@(x) 0; |
bmailhe@244 | 25 |
bmailhe@244 | 26 |
bmailhe@244 | 27 |
bmailhe@244 | 28 |
bmailhe@244 | 29 %set function f1 |
bmailhe@244 | 30 param_f1.verbose=param.verbose; |
bmailhe@244 | 31 |
bmailhe@244 | 32 f1.x0=A'*b; |
bmailhe@244 | 33 f1.norm= @(x) sum(sum(abs(x))); |
bmailhe@244 | 34 f1.prox= @(x,l) prox_L1(x,param.T*l,param_f1); |
bmailhe@244 | 35 |
bmailhe@244 | 36 |
bmailhe@244 | 37 |
bmailhe@244 | 38 %set initial point |
bmailhe@244 | 39 b2=A'*b; |
bmailhe@244 | 40 |
bmailhe@244 | 41 |
bmailhe@244 | 42 end |
bmailhe@244 | 43 |