function [x,R] = admm(x, K, ProxF, ProxKG, options) % admm - Alternating Directions Method of Multipliers algorithm % % [x,R] = admm(x, K, ProxF, ProxKG, options); % % Solves % min_x F(K*x) + G(x) % where F and G are proper closed convex functions, % and K is a linear operator such that K^*K is invertible. % F is supposed simple and G is also simple in the metric K^*K, i.e. % prox^K_{ga*G}(x) = argmin_y 1/2||x-K y||^2 + ga*G(x) is easy to compute. % % % INPUTS: % ProxF(y,ga) computes Prox_{ga*F}(y) % ProxKG(x,ga) computes Prox^K_{ga*G}(x) % K is the handle to the linear operator. % options.ga > 0 is the ADMM parameter. % options.verb=0 suppress display of progression. % options.niter is the number of iterations. % options.report(x) is a function to fill in R. % % OUTPUTS: % x is the final solution. % R(i) = options.report(x) at iteration i. % report = getoptions(options, 'report', @(x)0); niter = getoptions(options, 'niter', 100); theta = getoptions(options, 'theta', 1); verb = getoptions(options, 'verb', 1); if isnumeric(K) K = @(x)K*x; end R = []; u = K(x); w = u; for i=1:niter if verb progressbar(i,niter); end % record energies R(i) = report(x); % update x = ProxKG( u - w, gamma); s = K(x) + w; u = ProxF( s, gamma); w = s - u; end