diff util/SMALL_solve.m @ 159:23763c5fbda5 danieleb

Merge
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Wed, 31 Aug 2011 10:43:32 +0100
parents a4d0977d4595 b14209313ba4
children 4ea4badb2266
line wrap: on
line diff
--- a/util/SMALL_solve.m	Wed Aug 31 10:37:57 2011 +0100
+++ b/util/SMALL_solve.m	Wed Aug 31 10:43:32 2011 +0100
@@ -15,7 +15,7 @@
 %   published by the Free Software Foundation; either version 2 of the
 %   License, or (at your option) any later version.  See the file
 %   COPYING included with this distribution for more information.
-%
+%   
 %%
 
 if isa(Problem.A,'float')
@@ -45,58 +45,71 @@
 
 start=cputime;
 tStart=tic;
-switch solver.toolbox
-    case 'sparselab'
-        y = eval([solver.name,'(SparseLab_A, b, n,',solver.param,');']);
-    case 'sparsify'
+if strcmpi(solver.toolbox,'sparselab')
+    y = eval([solver.name,'(SparseLab_A, b, n,',solver.param,');']);
+elseif strcmpi(solver.toolbox,'sparsify')
+    if isa(Problem.A,'float')
+        y = eval([solver.name,'(b, A, n,',solver.param,');']);
+    else
         y = eval([solver.name,'(b, A, n, ''P_trans'', AT,',solver.param,');']);
-    case 'spgl1'
-        y = eval([solver.name,'(b, A,',solver.param,');']);
-    case 'gpsr'
-        y = eval([solver.name,'(b, A,',solver.param,');']);
-    case 'SPAMS'
-        y = eval([solver.name,'(b, A, solver.param);']);
-    case 'SMALL'
-        if isa(Problem.A,'float')
-            y = eval([solver.name,'(A, b, n,',solver.param,');']);
-        else
-            y = eval([solver.name,'(A, b, n,',solver.param,',AT);']);
-        end
-    case 'ompbox'
-        G = A'*A;
-        maxatoms=solver.param.maxatoms;
-        switch solver.name
-            case 'omp'
-                y = omp(A,b,G,maxatoms,'checkdict','off');
-            case 'omp2'
-                epsilon=solver.param.epsilon;
-                y = omp2(A,b,G,epsilon,'maxatoms',maxatoms,'checkdict','off');
-        end
-    case 'ompsbox'
-        basedict = Problem.basedict;
-        if issparse(Problem.A)
-            A = Problem.A;
-        else
-            A = sparse(Problem.A);
-        end
-        G = dicttsep(basedict,A,dictsep(basedict,A,speye(size(A,2))));
-        epsilon=solver.param.epsilon;
-        maxatoms=solver.param.maxatoms;
-        y = eval([solver.name,'(basedict, A, b, G,epsilon,''maxatoms'',maxatoms,''checkdict'',''off'');']);
-        Problem.sparse=1;
-        %   To introduce new sparse representation algorithm put the files in
-        %   your Matlab path. Next, unique name <TolboxID> for your toolbox and
-        %   prefferd API <Preffered_API> needs to be defined.
-        %
-        % elseif strcmpi(solver.toolbox,'<ToolboxID>')
-        %
-        %     % - Evaluate the function (solver.name - defined in the main) with
-        %     %   parameters given above
-        %
-        %     y = eval([solver.name,'(<Preffered_API>);']);
-    otherwise
-        printf('\nToolbox has not been registered. Please change SMALL_solver file.\n');
-        return
+    end
+elseif (strcmpi(solver.toolbox,'spgl1')||strcmpi(solver.toolbox,'gpsr'))
+    y = eval([solver.name,'(b, A,',solver.param,');']);
+elseif (strcmpi(solver.toolbox,'SPAMS'))
+    y = eval([solver.name,'(b, A, solver.param);']);
+elseif (strcmpi(solver.toolbox,'SMALL'))
+    if isa(Problem.A,'float')
+        y = eval([solver.name,'(A, b, n,',solver.param,');']);
+    else
+        y = eval([solver.name,'(A, b, n,',solver.param,',AT);']);
+    end
+elseif (strcmpi(solver.toolbox, 'ompbox'))
+    G=A'*A;
+    epsilon=solver.param.epsilon;
+    maxatoms=solver.param.maxatoms;
+    y = eval([solver.name,'(A, b, G,epsilon,''maxatoms'',maxatoms,''checkdict'',''off'');']);
+elseif (strcmpi(solver.toolbox, 'ompsbox'))
+    basedict = Problem.basedict;
+    if issparse(Problem.A)
+        A = Problem.A;
+    else
+        A = sparse(Problem.A);
+    end
+    G = dicttsep(basedict,A,dictsep(basedict,A,speye(size(A,2))));
+    epsilon=solver.param.epsilon;
+    maxatoms=solver.param.maxatoms;
+    y = eval([solver.name,'(basedict, A, b, G,epsilon,''maxatoms'',maxatoms,''checkdict'',''off'');']);
+    Problem.sparse=1;
+elseif (strcmpi(solver.toolbox, 'ALPS'))
+    if ~isa(Problem.A,'float')
+        % ALPS does not accept implicit dictionary definition
+        A = opToMatrix(Problem.A, 1);
+    end
+    [y, numiter, time, y_path] = wrapper_ALPS_toolbox(b, A, solver.param);
+elseif (strcmpi(solver.toolbox, 'MMbox'))
+    if ~isa(Problem.A,'float')
+        % ALPS does not accept implicit dictionary definition
+        A = opToMatrix(Problem.A, 1);
+    end
+    
+    [y, cost] = wrapper_mm_solver(b, A, solver.param);
+    
+     
+    
+    %   To introduce new sparse representation algorithm put the files in
+    %   your Matlab path. Next, unique name <TolboxID> for your toolbox and
+    %   prefferd API <Preffered_API> needs to be defined.
+    %
+    % elseif strcmpi(solver.toolbox,'<ToolboxID>')
+    %
+    %     % - Evaluate the function (solver.name - defined in the main) with
+    %     %   parameters given above
+    %
+    %     y = eval([solver.name,'(<Preffered_API>);']);
+    
+else
+    printf('\nToolbox has not been registered. Please change SMALL_solver file.\n');
+    return
 end
 
 %%