Mercurial > hg > smallbox
changeset 37:d80c103d9876
(none)
author | idamnjanovic |
---|---|
date | Mon, 14 Mar 2011 15:33:05 +0000 |
parents | e6191f5bb21b |
children | 84b7c44e54c4 |
files | util/SMALL_solve.m |
diffstat | 1 files changed, 30 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 <TolboxID> for your toolbox and % prefferd API <Preffered_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