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