comparison examples/ALPS solvers tests/SMALL_solver_test_ALPS.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 855025f4c779
comparison
equal deleted inserted replaced
153:af307f247ac7 154:0de08f68256b
1 %% Example test of solvers from different toolboxes on Sparco problem 6
2 %
3 % The main purpose of this example is to show how to use SMALL structure
4 % to solve SPARCO compressed sensing problems (1-11) and compare results
5 % from different solvers.
6 % To generate SMALL.Problem part of structure you can use generateProblem
7 % function from Sparco toolbox giving the problem number and any
8 % additional parameters you might want to change. Alternatively, you can
9 % might want to consult sparco documentation to write a problem by
10 % yourself. There are four fields the must be specified in SMALL.Problem
11 % - A, b, sizeA and reconstruct.
12 %
13 % To generate SMALL.solver part of the structure you must specify three
14 % fields:
15 %
16 % SMALL.solver.toolbox - string with toolbox name is needed because
17 % different toolboxes are calling solver
18 % functions in different ways.
19 % SMALL.solver.name - its string representing solver name (e.g.
20 % SolveOMP)
21 % SMALL.solver.param - string that contains optional parameters for
22 % particular solver (all parameters you want to
23 % specify except A, b and size of solution)
24 %
25 % Every call to SMALL_solve function will generate following output:
26 %
27 % SMALL.solver.solution - contains solution vector x
28 % SMALL.solver.reconstructed - vector containing signal reconstructed
29 % from the solution
30 % SMALL.solver.time - time that solver spent to find the solution
31 %
32 % SMALL_plot function plots the SMALL.solver.solution and reconstructed
33 % against original signal.
34 %
35 % In this particular example we are testing SMALL_cgp, SMALL_chol,
36 % SolveOMP form SparseLab and greed_pcgp form Sparsify against "PROB006
37 % Daubechies basis, Gaussian ensemble measurement basis, piecewise cubic
38 % polynomial signal" from Sparco.
39 %
40 %
41
42
43 % Centre for Digital Music, Queen Mary, University of London.
44 % This file copyright 2009 Ivan Damnjanovic.
45 %
46 % This program is free software; you can redistribute it and/or
47 % modify it under the terms of the GNU General Public License as
48 % published by the Free Software Foundation; either version 2 of the
49 % License, or (at your option) any later version. See the file
50 % COPYING included with this distribution for more information.
51 %%
52
53 fprintf('\n\nExample test of SMALL solvers against their counterparts on Sparco problems.\n\n');
54
55 %%
56 % Generate SPARCO problem
57 clear
58
59 SMALL.Problem = generateProblem(6, 'P', 6, 'm', 2*500,'n',2*1024, 'show');
60
61 SMALL.Problem.A = opToMatrix(SMALL.Problem.A, 1);
62
63 %%
64 i=1;
65 %%
66 % ALPS test
67 SMALL.solver(i) = SMALL_init_solver;
68 SMALL.solver(i).toolbox = 'ALPS';
69 SMALL.solver(i).name = 'AlgebraicPursuit';
70
71 % In the following string all parameters except matrix, measurement vector
72 % and size of solution need to be specified. If you are not sure which
73 % parameters are needed for particular solver type "help <Solver name>" in
74 % MATLAB command line
75
76 SMALL.solver(i).param=struct(...
77 'sparsity', 125,...
78 'memory', 0,...
79 'mode', 1,...
80 'iternum', 50,...
81 'tolerance', 1e-14');
82
83 SMALL.solver(i)=SMALL_solve(SMALL.Problem,SMALL.solver(i));
84
85
86 i=i+1;
87 %%
88 % SMALL Conjugate Gradient test
89 SMALL.solver(i)=SMALL_init_solver;
90 SMALL.solver(i).toolbox='SMALL';
91 SMALL.solver(i).name='SMALL_cgp';
92
93 % In the following string all parameters except matrix, measurement vector
94 % and size of solution need to be specified. If you are not sure which
95 % parameters are needed for particular solver type "help <Solver name>" in
96 % MATLAB command line
97
98 SMALL.solver(i).param='200, 1e-14';
99
100 SMALL.solver(i)=SMALL_solve(SMALL.Problem,SMALL.solver(i));
101
102
103 i=i+1;
104
105 %%
106 % SolveOMP from SparseLab test
107
108 SMALL.solver(i)=SMALL_init_solver;
109 SMALL.solver(i).toolbox='SparseLab';
110 SMALL.solver(i).name='SolveOMP';
111
112 % In the following string all parameters except matrix, measurement vector
113 % and size of solution need to be specified. If you are not sure which
114 % parameters are needed for particular solver type "help <Solver name>" in
115 % MATLAB command line
116
117 SMALL.solver(i).param='200, 0, 0, 0, 1e-14';
118
119 SMALL.solver(i)=SMALL_solve(SMALL.Problem, SMALL.solver(i));
120
121 i=i+1;
122
123 %%
124 % SMALL OMP with Cholesky update test
125 SMALL.solver(i)=SMALL_init_solver;
126 SMALL.solver(i).toolbox='SMALL';
127 SMALL.solver(i).name='SMALL_chol';
128
129 % In the following string all parameters except matrix, measurement vector
130 % and size of solution need to be specified. If you are not sure which
131 % parameters are needed for particular solver type "help <Solver name>" in
132 % MATLAB command line
133
134 SMALL.solver(i).param='200, 1e-14';
135
136 SMALL.solver(i)=SMALL_solve(SMALL.Problem, SMALL.solver(i));
137
138 i=i+1;
139
140 %%
141 % greed_pcgp from Sparsify test
142
143 SMALL.solver(i)=SMALL_init_solver;
144 SMALL.solver(i).toolbox='Sparsify';
145 SMALL.solver(i).name='greed_pcgp';
146
147 % In the following string all parameters except matrix, measurement vector
148 % and size of solution need to be specified. If you are not sure which
149 % parameters are needed for particular solver type "help <Solver name>" in
150 % MATLAB command line
151
152 SMALL.solver(i).param='''stopCrit'', ''M'', ''stopTol'', 200';
153
154 SMALL.solver(i)=SMALL_solve(SMALL.Problem, SMALL.solver(i));
155
156 %%
157
158 SMALL_plot(SMALL);
159
160
161
162
163