annotate toolboxes/wrapper_ALPS_toolbox.m @ 186:9c418bea7f6a bug_386

Addresses Bug #386: removed the 4th output variable (versn) in all calls of function fileparts.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 09 Feb 2012 17:25:14 +0000
parents 0de08f68256b
children
rev   line source
ivan@154 1 function [x , numiter, time, x_path] = wrapper_ALPS_toolbox(b, A, param)
ivan@154 2 %% SMALL wrapper for ALPS toolbox
ivan@154 3 %
ivan@154 4 % Function gets as input
ivan@154 5 % b - measurement vector
ivan@154 6 % A - dictionary
ivan@154 7 % K - desired sparsity level
ivan@154 8 % param - structure containing additional parameters
ivan@154 9 % Output:
ivan@154 10 % x - sparse solution
ivan@154 11 % numiter - number of iterations
ivan@154 12 % time - time needed to solve the problem#
ivan@154 13 % x_path - matrix containing x after every iteration
ivan@154 14
ivan@154 15 % Centre for Digital Music, Queen Mary, University of London.
ivan@154 16 % This file copyright 2011 Ivan Damnjanovic.
ivan@154 17 %
ivan@154 18 % This program is free software; you can redistribute it and/or
ivan@154 19 % modify it under the terms of the GNU General Public License as
ivan@154 20 % published by the Free Software Foundation; either version 2 of the
ivan@154 21 % License, or (at your option) any later version. See the file
ivan@154 22 % COPYING included with this distribution for more information.
ivan@154 23 %
ivan@154 24 %%
ivan@154 25
ivan@154 26 if isfield(param, 'sparsity')
ivan@154 27 sparsity = param.sparsity;
ivan@154 28 else
ivan@154 29 printf('\nAlebraic Pursuit algorithms require desired sparsity level.\n("sparsity" field in solver parameters structure)\n ');
ivan@154 30 return
ivan@154 31 end
ivan@154 32
ivan@154 33 if isfield(param, 'memory')
ivan@154 34 memory = param.memory;
ivan@154 35 else
ivan@154 36 memory = 0;
ivan@154 37 end
ivan@154 38
ivan@154 39 if isfield(param, 'mode')
ivan@154 40 mode = param.mode;
ivan@154 41 else
ivan@154 42 mode = 0;
ivan@154 43 end
ivan@154 44 if isfield(param, 'tolerance')
ivan@154 45 tolerance = param.tolerance;
ivan@154 46 else
ivan@154 47 tolerance = 1e-5;
ivan@154 48 end
ivan@154 49 if isfield(param, 'iternum')
ivan@154 50 iternum = param.iternum;
ivan@154 51 else
ivan@154 52 iternum = 300;
ivan@154 53 end
ivan@154 54 if isfield(param, 'verbose')
ivan@154 55 verbose = param.verbose;
ivan@154 56 else
ivan@154 57 verbose = 0;
ivan@154 58 end
ivan@154 59 if isfield(param, 'tau')
ivan@154 60 tau = param.tau;
ivan@154 61 else
ivan@154 62 tau = 1/2;
ivan@154 63 end
ivan@154 64 if isfield(param, 'useCG')
ivan@154 65 useCG = param.useCG;
ivan@154 66 else
ivan@154 67 useCG = 0;
ivan@154 68 end
ivan@154 69 if isfield(param, 'mu')
ivan@154 70 mu = param.mu;
ivan@154 71 else
ivan@154 72 mu = 0;
ivan@154 73 end
ivan@154 74 training_size = size(b,2);
ivan@154 75 x=zeros(size(A,2),training_size);
ivan@154 76 for i = 1:training_size
ivan@154 77 [x(:,i), numiter, time, x_path] = AlgebraicPursuit(b(:,i), A, sparsity, 'memory', memory,...
ivan@154 78 'mode', mode, 'tolerance', tolerance, 'ALPSiterations', iternum, ...
ivan@154 79 'verbose', verbose, 'tau', tau, 'useCG', useCG, 'mu', mu);
ivan@154 80 end