Mercurial > hg > smallbox
comparison toolboxes/wrapper_ALPS_toolbox.m @ 154:0de08f68256b ivand_dev
ALPS toolbox - Algebraic Pursuit added to smallbox
author | Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk> |
---|---|
date | Fri, 12 Aug 2011 11:17:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
153:af307f247ac7 | 154:0de08f68256b |
---|---|
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 | |
9 % Output: | |
10 % x - sparse solution | |
11 % numiter - number of iterations | |
12 % time - time needed to solve the problem# | |
13 % x_path - matrix containing x after every iteration | |
14 | |
15 % Centre for Digital Music, Queen Mary, University of London. | |
16 % This file copyright 2011 Ivan Damnjanovic. | |
17 % | |
18 % This program is free software; you can redistribute it and/or | |
19 % modify it under the terms of the GNU General Public License as | |
20 % published by the Free Software Foundation; either version 2 of the | |
21 % License, or (at your option) any later version. See the file | |
22 % COPYING included with this distribution for more information. | |
23 % | |
24 %% | |
25 | |
26 if isfield(param, 'sparsity') | |
27 sparsity = param.sparsity; | |
28 else | |
29 printf('\nAlebraic Pursuit algorithms require desired sparsity level.\n("sparsity" field in solver parameters structure)\n '); | |
30 return | |
31 end | |
32 | |
33 if isfield(param, 'memory') | |
34 memory = param.memory; | |
35 else | |
36 memory = 0; | |
37 end | |
38 | |
39 if isfield(param, 'mode') | |
40 mode = param.mode; | |
41 else | |
42 mode = 0; | |
43 end | |
44 if isfield(param, 'tolerance') | |
45 tolerance = param.tolerance; | |
46 else | |
47 tolerance = 1e-5; | |
48 end | |
49 if isfield(param, 'iternum') | |
50 iternum = param.iternum; | |
51 else | |
52 iternum = 300; | |
53 end | |
54 if isfield(param, 'verbose') | |
55 verbose = param.verbose; | |
56 else | |
57 verbose = 0; | |
58 end | |
59 if isfield(param, 'tau') | |
60 tau = param.tau; | |
61 else | |
62 tau = 1/2; | |
63 end | |
64 if isfield(param, 'useCG') | |
65 useCG = param.useCG; | |
66 else | |
67 useCG = 0; | |
68 end | |
69 if isfield(param, 'mu') | |
70 mu = param.mu; | |
71 else | |
72 mu = 0; | |
73 end | |
74 training_size = size(b,2); | |
75 x=zeros(size(A,2),training_size); | |
76 for i = 1:training_size | |
77 [x(:,i), numiter, time, x_path] = AlgebraicPursuit(b(:,i), A, sparsity, 'memory', memory,... | |
78 'mode', mode, 'tolerance', tolerance, 'ALPSiterations', iternum, ... | |
79 'verbose', verbose, 'tau', tau, 'useCG', useCG, 'mu', mu); | |
80 end |