comparison util/SMALL_solve.m @ 1:7750624e0c73 version0.5

(none)
author idamnjanovic
date Thu, 05 Nov 2009 16:36:01 +0000
parents
children 33850553b702
comparison
equal deleted inserted replaced
0:5181bee80bc1 1:7750624e0c73
1 function SMALL = SMALL_solve(SMALL)
2 % Ivan Damnjanovic 2009
3 % Function gets as input SMALL structure that contains SPARCO problem to
4 % be solved, name of the toolbox and solver, and parameters file for particular solver
5 % Outputs are solution, reconstructed signal and time spent
6 %%
7
8 A = @(x) SMALL.Problem.A(x,1); % The operator
9 AT = @(y) SMALL.Problem.A(y,2); % and its transpose.
10 b = SMALL.Problem.b; % The right-hand-side vector.
11 m = SMALL.Problem.sizeA(1); % m is the no. of rows.
12 n = SMALL.Problem.sizeA(2); % n is the no. of columns.
13
14 fprintf('\nStarting solver %s... \n', SMALL.solver.name);
15 start=cputime;
16 %%
17 if strcmpi(SMALL.solver.toolbox,'sparselab')
18 y = eval([SMALL.solver.name,'(''SL_A'', b, n,',SMALL.solver.param,');']);
19 elseif strcmpi(SMALL.solver.toolbox,'sparsify')
20 y = eval([SMALL.solver.name,'(b, A, n, ''P_trans'', AT,',SMALL.solver.param,');']);
21 elseif (strcmpi(SMALL.solver.toolbox,'spgl1')||strcmpi(SMALL.solver.toolbox,'gpsr'))
22 y = eval([SMALL.solver.name,'(b, A,',SMALL.solver.param,');']);
23 else
24 y = eval([SMALL.solver.name,'(A, b, n,',SMALL.solver.param,',AT);']);
25 end
26 %%
27 SMALL.solver.time = cputime - start;
28 fprintf('Solver %s finished task in %2f seconds. \n', SMALL.solver.name, SMALL.solver.time);
29 SMALL.solver.solution = full(y);
30 SMALL.solver.reconstructed = SMALL.Problem.reconstruct(SMALL.solver.solution);
31 end
32