aris@219: function [x , numiter, time, x_path] = wrapper_ALPS_toolbox(b, A, param) aris@219: %% SMALL wrapper for ALPS toolbox aris@219: % aris@219: % Function gets as input aris@219: % b - measurement vector aris@219: % A - dictionary aris@219: % K - desired sparsity level aris@219: % param - structure containing additional parameters. These are: aris@219: % - memory Memory (momentum) of proposed algorithm. aris@219: % Possible values are 0,1,'infty' for memoryless, aris@219: % one memory and infinity memory ALPS, aris@219: % respectively. Default value: memory = 0. aris@219: % - tol Early stopping tolerance. Default value: tol = aris@219: % 1-e5. aris@219: % - ALPSiters Maximum number of algorithm iterations. Default aris@219: % value: 300. aris@219: % - mod According to [1], possible values are aris@219: % [0,1,2,4,5,6]. This value comes from the binary aris@219: % representation of the parameters: aris@219: % (solveNewtob, gradientDescentx, solveNewtonx), aris@219: % which are explained next. Default value = 0. aris@219: % - mu Variable that controls the step size selection. aris@219: % When mu = 0, step size is computed adaptively aris@219: % per iteration. Default value: mu = 0. aris@219: % - tau Variable that controls the momentum in aris@219: % non-memoryless case. Ignored in memoryless aris@219: % case. User can insert as value a function handle on tau. aris@219: % Description given below. Default value: tau = -1. aris@219: % - CGiters Maximum iterations for Conjugate-Gradients method. aris@219: % - CGtol Tolerance variable for Conjugate-Gradients method. aris@219: % - verbose verbose = 1 prints out execution infromation. aris@219: % Output: aris@219: % x - sparse solution aris@219: % numiter - number of iterations aris@219: % time - time needed to solve the problem# aris@219: % x_path - matrix containing x after every iteration aris@219: % aris@219: % For more details see AlgebraicPursuit.m. aris@219: aris@219: % aris@219: % Centre for Digital Music, Queen Mary, University of London. aris@219: % This file copyright 2011 Ivan Damnjanovic. aris@219: % aris@219: % This program is free software; you can redistribute it and/or aris@219: % modify it under the terms of the GNU General Public License as aris@219: % published by the Free Software Foundation; either version 2 of the aris@219: % License, or (at your option) any later version. See the file aris@219: % COPYING included with this distribution for more information. aris@219: % aris@219: %% aris@219: aris@219: if isfield(param, 'sparsity') aris@219: sparsity = param.sparsity; aris@219: else aris@219: printf('\nAlebraic Pursuit algorithms require desired sparsity level.\n("sparsity" field in solver parameters structure)\n '); aris@219: return aris@219: end aris@219: aris@219: if isfield(param, 'memory') aris@219: memory = param.memory; aris@219: else aris@219: memory = 0; aris@219: end aris@219: aris@219: if isfield(param, 'mode') aris@219: mode = param.mode; aris@219: else aris@219: mode = 0; aris@219: end aris@219: if isfield(param, 'tolerance') aris@219: tolerance = param.tolerance; aris@219: else aris@219: tolerance = 1e-5; aris@219: end aris@219: if isfield(param, 'iternum') aris@219: iternum = param.iternum; aris@219: else aris@219: iternum = 300; aris@219: end aris@219: if isfield(param, 'verbose') aris@219: verbose = param.verbose; aris@219: else aris@219: verbose = 0; aris@219: end aris@219: if isfield(param, 'tau') aris@219: tau = param.tau; aris@219: else aris@219: tau = 1/2; aris@219: end aris@219: if isfield(param, 'useCG') aris@219: useCG = param.useCG; aris@219: else aris@219: useCG = 0; aris@219: end aris@219: if isfield(param, 'mu') aris@219: mu = param.mu; aris@219: else aris@219: mu = 0; aris@219: end aris@219: training_size = size(b,2); aris@219: x=zeros(size(A,2),training_size); aris@219: for i = 1:training_size aris@219: [x(:,i), numiter, time, x_path] = AlgebraicPursuit(b(:,i), A, sparsity, 'memory', memory,... aris@219: 'mode', mode, 'tolerance', tolerance, 'ALPSiterations', iternum, ... aris@219: 'verbose', verbose, 'tau', tau, 'useCG', useCG, 'mu', mu); aris@219: end