Mercurial > hg > smallbox
changeset 22:524cc3fff5ac
(none)
author | idamnjanovic |
---|---|
date | Tue, 27 Apr 2010 13:32:27 +0000 |
parents | 0211faef9add |
children | 636a2a3d7302 |
files | solvers/SMALL_MP.m solvers/SMALL_cgp.m solvers/SMALL_chol.m |
diffstat | 3 files changed, 38 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/solvers/SMALL_MP.m Tue Apr 27 13:31:44 2010 +0000 +++ b/solvers/SMALL_MP.m Tue Apr 27 13:32:27 2010 +0000 @@ -1,6 +1,15 @@ function [A]=SMALL_MP(Dict,X, m, maxNumCoef, errorGoal, varargin) %% -%============================================= +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% 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. +% % Sparse coding of a group of signals based on a given % dictionary and specified number of atoms to use. % input arguments: Dict - the dictionary @@ -12,11 +21,7 @@ % optional: if Dict is function handle then Transpose Dictionary % handle needs to be specified. % -% based on KSVD toolbox solver found on Miki Elad webpage (finding inverse -% with pinv() is changed with matching pursuit) -% Ivan Damnjanovic 2009 -%============================================= -%% + %% % This Dictionary check is based on Thomas Blumensath work in sparsify 0_4 greedy solvers explicitD=0;
--- a/solvers/SMALL_cgp.m Tue Apr 27 13:31:44 2010 +0000 +++ b/solvers/SMALL_cgp.m Tue Apr 27 13:32:27 2010 +0000 @@ -1,5 +1,15 @@ function [A, resF]=SMALL_cgp(Dict,X, m, maxNumCoef, errorGoal, varargin) -%============================================= +%%% Conjugate Gradient Pursuit Multiple vectors sparse representation +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% 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. +% % Sparse coding of a group of signals based on a given % dictionary and specified number of atoms to use. % input arguments: Dict - the dictionary @@ -13,11 +23,6 @@ % % output arguments: A - sparse coefficient matrix. % -% based on KSVD toolbox solver found on Miki Elad webpage (finding inverse -% with pinv() is changed with conjugate gradient method) -% Ivan Damnjanovic 2009 -%============================================= -%% %% % This Dictionary check is based on Thomas Blumensath work in sparsify 0_4 greedy solvers @@ -43,7 +48,7 @@ error('Dictionary is of unsupported type. Use explicit matrix, function_handle or object. Exiting.'); end %% - +positivity=1; [n,P]=size(X); @@ -67,8 +72,11 @@ j = j+1; dir=Dt(residual); - - [tmp__, pos]=max(abs(dir)); + if exist('positivity','var')&&(positivity==1) + [tmp__, pos]=max(dir); + else + [tmp__, pos]=max(abs(dir)); + end indx(j)=pos; p(indx)=dir(indx);
--- a/solvers/SMALL_chol.m Tue Apr 27 13:31:44 2010 +0000 +++ b/solvers/SMALL_chol.m Tue Apr 27 13:32:27 2010 +0000 @@ -1,6 +1,15 @@ function [A]=SMALL_chol(Dict,X, m, maxNumCoef, errorGoal, varargin) %% -%============================================= +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% 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. +% % Sparse coding of a group of signals based on a given % dictionary and specified number of atoms to use. % input arguments: Dict - the dictionary @@ -14,10 +23,6 @@ % % output arguments: A - sparse coefficient matrix. % -% based on KSVD toolbox solver found on Miki Elad webpage (finding inverse -% with pinv() is changed with OMP Cholesky update) -% Ivan Damnjanovic 2009 -%============================================= %% % This Dictionary check is based on Thomas Blumensath work in sparsify 0_4 greedy solvers explicitD=0;