comparison util/SMALL_solve.m @ 224:fd0b5d36f6ad danieleb

Updated the contents of this branch with the contents of the default branch.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 12 Apr 2012 13:52:28 +0100
parents 4ea4badb2266 a986ee86651e
children
comparison
equal deleted inserted replaced
196:82b0d3f982cb 224:fd0b5d36f6ad
13 % This program is free software; you can redistribute it and/or 13 % This program is free software; you can redistribute it and/or
14 % modify it under the terms of the GNU General Public License as 14 % modify it under the terms of the GNU General Public License as
15 % published by the Free Software Foundation; either version 2 of the 15 % published by the Free Software Foundation; either version 2 of the
16 % License, or (at your option) any later version. See the file 16 % License, or (at your option) any later version. See the file
17 % COPYING included with this distribution for more information. 17 % COPYING included with this distribution for more information.
18 % 18 %
19 %% 19 %%
20
21 SMALLboxInit
20 22
21 if isa(Problem.A,'float') 23 if isa(Problem.A,'float')
22 A = Problem.A; 24 A = Problem.A;
23 SparseLab_A=Problem.A; 25 SparseLab_A=Problem.A;
24 m = size(Problem.A,1); % m is the no. of rows. 26 m = size(Problem.A,1); % m is the no. of rows.
43 fprintf('\nStarting solver %s... \n', solver.name); 45 fprintf('\nStarting solver %s... \n', solver.name);
44 end 46 end
45 47
46 start=cputime; 48 start=cputime;
47 tStart=tic; 49 tStart=tic;
48 if strcmpi(solver.toolbox,'sparselab') 50
49 y = eval([solver.name,'(SparseLab_A, b, n,',solver.param,');']); 51 % solvers configuration file
50 elseif strcmpi(solver.toolbox,'sparsify') 52 run(fullfile(SMALL_path, 'config/SMALL_solve_config.m'));
51 if isa(Problem.A,'float')
52 y = eval([solver.name,'(b, A, n,',solver.param,');']);
53 else
54 y = eval([solver.name,'(b, A, n, ''P_trans'', AT,',solver.param,');']);
55 end
56 elseif (strcmpi(solver.toolbox,'spgl1')||strcmpi(solver.toolbox,'gpsr'))
57 y = eval([solver.name,'(b, A,',solver.param,');']);
58 elseif (strcmpi(solver.toolbox,'SPAMS'))
59 y = eval([solver.name,'(b, A, solver.param);']);
60 elseif (strcmpi(solver.toolbox,'SMALL'))
61 if isa(Problem.A,'float')
62 y = eval([solver.name,'(A, b, n,',solver.param,');']);
63 else
64 y = eval([solver.name,'(A, b, n,',solver.param,',AT);']);
65 end
66 elseif (strcmpi(solver.toolbox, 'ompbox'))
67 G=A'*A;
68 epsilon=solver.param.epsilon;
69 maxatoms=solver.param.maxatoms;
70 y = eval([solver.name,'(A, b, G,epsilon,''maxatoms'',maxatoms,''checkdict'',''off'');']);
71 elseif (strcmpi(solver.toolbox, 'ompsbox'))
72 basedict = Problem.basedict;
73 if issparse(Problem.A)
74 A = Problem.A;
75 else
76 A = sparse(Problem.A);
77 end
78 G = dicttsep(basedict,A,dictsep(basedict,A,speye(size(A,2))));
79 epsilon=solver.param.epsilon;
80 maxatoms=solver.param.maxatoms;
81 y = eval([solver.name,'(basedict, A, b, G,epsilon,''maxatoms'',maxatoms,''checkdict'',''off'');']);
82 Problem.sparse=1;
83 elseif (strcmpi(solver.toolbox, 'ALPS'))
84 if ~isa(Problem.A,'float')
85 % ALPS does not accept implicit dictionary definition
86 A = opToMatrix(Problem.A, 1);
87 end
88 [y, numiter, time, y_path] = wrapper_ALPS_toolbox(b, A, solver.param);
89 elseif (strcmpi(solver.toolbox, 'MMbox'))
90 if ~isa(Problem.A,'float')
91 % MMbox does not accept implicit dictionary definition
92 A = opToMatrix(Problem.A, 1);
93 end
94
95 [y, cost] = wrapper_mm_solver(b, A, solver.param);
96
97
98
99 % To introduce new sparse representation algorithm put the files in
100 % your Matlab path. Next, unique name <TolboxID> for your toolbox and
101 % prefferd API <Preffered_API> needs to be defined.
102 %
103 % elseif strcmpi(solver.toolbox,'<ToolboxID>')
104 %
105 % % - Evaluate the function (solver.name - defined in the main) with
106 % % parameters given above
107 %
108 % y = eval([solver.name,'(<Preffered_API>);']);
109
110 else
111 printf('\nToolbox has not been registered. Please change SMALL_solver file.\n');
112 return
113 end
114 53
115 %% 54 %%
116 % Sparse representation time 55 % Sparse representation time
117 tElapsed=toc(tStart); 56 tElapsed=toc(tStart);
118 solver.time = cputime - start; 57 solver.time = cputime - start;