# HG changeset patch # User idamnjanovic # Date 1300116785 0 # Node ID d80c103d9876954b79de52928e2844267fa2eefb # Parent e6191f5bb21b6ba90f79caaca3a568b703365eb0 diff -r e6191f5bb21b -r d80c103d9876 util/SMALL_solve.m --- a/util/SMALL_solve.m Mon Mar 14 15:32:52 2011 +0000 +++ b/util/SMALL_solve.m Mon Mar 14 15:33:05 2011 +0000 @@ -30,11 +30,17 @@ n = Problem.sizeA(2); % n is the no. of columns. end -b = Problem.b; % The right-hand-side vector. +% if signal that needs to be represented is different then training set for +% dictionary learning it should be stored in Problem.b1 matix +if isfield(Problem, 'b1') + b = Problem.b1; +else + b = Problem.b; % The right-hand-side vector. +end %% fprintf('\nStarting solver %s... \n', solver.name); start=cputime; - +tStart=tic; if strcmpi(solver.toolbox,'sparselab') y = eval([solver.name,'(SparseLab_A, b, n,',solver.param,');']); elseif strcmpi(solver.toolbox,'sparsify') @@ -49,7 +55,23 @@ 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 for your toolbox and % prefferd API needs to be defined. @@ -68,10 +90,11 @@ %% % Sparse representation time - +tElapsed=toc(tStart); solver.time = cputime - start; fprintf('Solver %s finished task in %2f seconds. \n', solver.name, solver.time); - +fprintf('Solver %s finished task in %2f seconds. \n', solver.name, tElapsed); +solver.time=tElapsed; % geting around out of memory problem when converting big matrix from % sparse to full... @@ -80,7 +103,8 @@ else solver.solution = full(y); end - +if isfield(Problem,'reconstruct') % Reconstruct the signal from the solution solver.reconstructed = Problem.reconstruct(solver.solution); end +end