comparison toolboxes/alps/wrapper_ALPS_toolbox.m @ 219:4337e28183f1 luisf_dev

Modified help comments of wrapper_mm_DL.m, wrapper_mm_solver.m, SMALL_rlsdla.m & SMALL_AudioDenoise_DL_test_KSVDvsSPAMS.m. Moved wrapper_ALPS_toolbox from toolboxes to toolboxes/alps and added some extra help comments.
author Aris Gretsistas <aris.gretsistas@elec.qmul.ac.uk>
date Fri, 23 Mar 2012 20:48:25 +0000
parents
children
comparison
equal deleted inserted replaced
218:c38d965b5a1d 219:4337e28183f1
1 function [x , numiter, time, x_path] = wrapper_ALPS_toolbox(b, A, param)
2 %% SMALL wrapper for ALPS toolbox
3 %
4 % Function gets as input
5 % b - measurement vector
6 % A - dictionary
7 % K - desired sparsity level
8 % param - structure containing additional parameters. These are:
9 % - memory Memory (momentum) of proposed algorithm.
10 % Possible values are 0,1,'infty' for memoryless,
11 % one memory and infinity memory ALPS,
12 % respectively. Default value: memory = 0.
13 % - tol Early stopping tolerance. Default value: tol =
14 % 1-e5.
15 % - ALPSiters Maximum number of algorithm iterations. Default
16 % value: 300.
17 % - mod According to [1], possible values are
18 % [0,1,2,4,5,6]. This value comes from the binary
19 % representation of the parameters:
20 % (solveNewtob, gradientDescentx, solveNewtonx),
21 % which are explained next. Default value = 0.
22 % - mu Variable that controls the step size selection.
23 % When mu = 0, step size is computed adaptively
24 % per iteration. Default value: mu = 0.
25 % - tau Variable that controls the momentum in
26 % non-memoryless case. Ignored in memoryless
27 % case. User can insert as value a function handle on tau.
28 % Description given below. Default value: tau = -1.
29 % - CGiters Maximum iterations for Conjugate-Gradients method.
30 % - CGtol Tolerance variable for Conjugate-Gradients method.
31 % - verbose verbose = 1 prints out execution infromation.
32 % Output:
33 % x - sparse solution
34 % numiter - number of iterations
35 % time - time needed to solve the problem#
36 % x_path - matrix containing x after every iteration
37 %
38 % For more details see AlgebraicPursuit.m.
39
40 %
41 % Centre for Digital Music, Queen Mary, University of London.
42 % This file copyright 2011 Ivan Damnjanovic.
43 %
44 % This program is free software; you can redistribute it and/or
45 % modify it under the terms of the GNU General Public License as
46 % published by the Free Software Foundation; either version 2 of the
47 % License, or (at your option) any later version. See the file
48 % COPYING included with this distribution for more information.
49 %
50 %%
51
52 if isfield(param, 'sparsity')
53 sparsity = param.sparsity;
54 else
55 printf('\nAlebraic Pursuit algorithms require desired sparsity level.\n("sparsity" field in solver parameters structure)\n ');
56 return
57 end
58
59 if isfield(param, 'memory')
60 memory = param.memory;
61 else
62 memory = 0;
63 end
64
65 if isfield(param, 'mode')
66 mode = param.mode;
67 else
68 mode = 0;
69 end
70 if isfield(param, 'tolerance')
71 tolerance = param.tolerance;
72 else
73 tolerance = 1e-5;
74 end
75 if isfield(param, 'iternum')
76 iternum = param.iternum;
77 else
78 iternum = 300;
79 end
80 if isfield(param, 'verbose')
81 verbose = param.verbose;
82 else
83 verbose = 0;
84 end
85 if isfield(param, 'tau')
86 tau = param.tau;
87 else
88 tau = 1/2;
89 end
90 if isfield(param, 'useCG')
91 useCG = param.useCG;
92 else
93 useCG = 0;
94 end
95 if isfield(param, 'mu')
96 mu = param.mu;
97 else
98 mu = 0;
99 end
100 training_size = size(b,2);
101 x=zeros(size(A,2),training_size);
102 for i = 1:training_size
103 [x(:,i), numiter, time, x_path] = AlgebraicPursuit(b(:,i), A, sparsity, 'memory', memory,...
104 'mode', mode, 'tolerance', tolerance, 'ALPSiterations', iternum, ...
105 'verbose', verbose, 'tau', tau, 'useCG', useCG, 'mu', mu);
106 end