ivan@155
|
1 function [X , cost] = wrapper_mm_solver(b, A, param)
|
aris@211
|
2 %% SMALL wrapper for Majorization Minimization toolbox solver
|
ivan@155
|
3 %
|
ivan@155
|
4 % Function gets as input
|
ivan@155
|
5 % b - measurement vector
|
ivan@155
|
6 % A - dictionary
|
aris@219
|
7 % param - structure containing additional parameters. These are:
|
aris@219
|
8 % - initcoeff Initial guess for the coefficients
|
aris@219
|
9 % (optional)
|
aris@219
|
10 % - to 1/(step size). It is larger than spectral norm
|
aris@219
|
11 % of dictionary A (default is 0.1+(svds(A,1))^2)
|
aris@219
|
12 % - lambda Lagrangian multiplier. Regulates shrinkage
|
aris@219
|
13 % (default is 0.4)
|
aris@219
|
14 % - iternum Inner-loop maximum iteration number
|
aris@219
|
15 % (default is 1000)
|
aris@219
|
16 % - epsilon Stopping criterion for iterative softthresholding
|
aris@219
|
17 % (default is 1e-7)
|
aris@219
|
18 % - map Debiasing. 0 = No, 1 = Yes (default is 0)
|
aris@219
|
19 %
|
ivan@155
|
20 % Output:
|
ivan@155
|
21 % x - sparse solution
|
ivan@155
|
22 % cost - Objective cost
|
ivan@155
|
23
|
aris@219
|
24 %
|
ivan@155
|
25 % Centre for Digital Music, Queen Mary, University of London.
|
ivan@155
|
26 % This file copyright 2011 Ivan Damnjanovic.
|
ivan@155
|
27 %
|
ivan@155
|
28 % This program is free software; you can redistribute it and/or
|
ivan@155
|
29 % modify it under the terms of the GNU General Public License as
|
ivan@155
|
30 % published by the Free Software Foundation; either version 2 of the
|
ivan@155
|
31 % License, or (at your option) any later version. See the file
|
ivan@155
|
32 % COPYING included with this distribution for more information.
|
ivan@155
|
33 %
|
ivan@155
|
34 %%
|
ivan@155
|
35
|
ivan@155
|
36 % Initial guess for the coefficients
|
ivan@155
|
37
|
ivan@155
|
38 if (isfield(param, 'initcoeff'))
|
ivan@155
|
39 initX = param.initcoeff;
|
ivan@155
|
40 else
|
ivan@155
|
41 initX = zeros(size(A,2),size(b,2));
|
ivan@155
|
42 end
|
ivan@155
|
43
|
ivan@155
|
44 % to - 1/(step size) . It is larger than spectral norm of dictionary A
|
ivan@155
|
45
|
ivan@155
|
46 if isfield(param, 'to')
|
ivan@155
|
47 to = param.to;
|
ivan@155
|
48 else
|
ivan@161
|
49 to = .1+(svds(A,1))^2;
|
ivan@155
|
50 end
|
ivan@155
|
51
|
ivan@155
|
52 % lambda - Lagrangian multiplier. (regulates shrinkage)
|
ivan@155
|
53
|
ivan@155
|
54 if isfield(param, 'lambda')
|
ivan@155
|
55 lambda = param.lambda;
|
ivan@155
|
56 else
|
ivan@155
|
57 lambda = 2*.2;
|
ivan@155
|
58 end
|
ivan@155
|
59
|
ivan@155
|
60 % Inner-loop maximum iteration number.
|
ivan@155
|
61
|
ivan@155
|
62 if isfield(param, 'iternum')
|
ivan@155
|
63 maxIT = param.iternum;
|
ivan@155
|
64 else
|
ivan@155
|
65 maxIT = 1000;
|
ivan@155
|
66 end
|
ivan@155
|
67
|
ivan@155
|
68 % Stopping criterion for iterative softthresholding
|
ivan@155
|
69
|
ivan@155
|
70 if isfield(param, 'epsilon')
|
ivan@155
|
71 epsilon = param.epsilon;
|
ivan@155
|
72 else
|
ivan@155
|
73 epsilon = 1e-7;
|
ivan@155
|
74 end
|
ivan@155
|
75
|
ivan@155
|
76 % Debiasing. 0 = No, 1 = Yes
|
ivan@155
|
77
|
ivan@155
|
78 if isfield(param, 'map')
|
ivan@155
|
79 map = param.map;
|
ivan@155
|
80 else
|
ivan@161
|
81 map = 0;
|
ivan@155
|
82 end
|
ivan@155
|
83
|
ivan@155
|
84
|
ivan@155
|
85 [X, cost] = mm1(A,b,initX,to,lambda,maxIT,epsilon,map);
|
ivan@155
|
86 cost
|
ivan@155
|
87 end |