# HG changeset patch # User idamnjanovic # Date 1272375147 0 # Node ID 524cc3fff5ac4122c7b9487f0b83757780df8a0d # Parent 0211faef9adda522f2370b5c34f47eef01ac9175 diff -r 0211faef9add -r 524cc3fff5ac solvers/SMALL_MP.m --- 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; diff -r 0211faef9add -r 524cc3fff5ac solvers/SMALL_cgp.m --- 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); diff -r 0211faef9add -r 524cc3fff5ac solvers/SMALL_chol.m --- 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;