diff util/SMALL_solve.m @ 156:a4d0977d4595 danieleb

First branch commit, danieleb
author danieleb
date Tue, 30 Aug 2011 11:12:31 +0100
parents 31d2864dfdd4
children 23763c5fbda5
line wrap: on
line diff
--- a/util/SMALL_solve.m	Fri Jul 29 12:35:52 2011 +0100
+++ b/util/SMALL_solve.m	Tue Aug 30 11:12:31 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,51 +45,58 @@
 
 start=cputime;
 tStart=tic;
-if strcmpi(solver.toolbox,'sparselab')
-    y = eval([solver.name,'(SparseLab_A, b, n,',solver.param,');']);
-elseif strcmpi(solver.toolbox,'sparsify')
-    y = eval([solver.name,'(b, A, n, ''P_trans'', AT,',solver.param,');']);
-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;
-%   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
+switch solver.toolbox
+    case 'sparselab'
+        y = eval([solver.name,'(SparseLab_A, b, n,',solver.param,');']);
+    case 'sparsify'
+        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
 
 %%