Mercurial > hg > smallbox
comparison solvers/SMALL_MP.m @ 2:257c289bf11d
(none)
author | idamnjanovic |
---|---|
date | Fri, 05 Mar 2010 12:23:57 +0000 |
parents | 7750624e0c73 |
children | 01cad25206d6 |
comparison
equal
deleted
inserted
replaced
1:7750624e0c73 | 2:257c289bf11d |
---|---|
1 function [A]=SMALL_MP(Dict,X, m, maxNumCoef, errorGoal, varargin) | 1 function [A]=SMALL_MP(Dict,X, m, maxNumCoef, errorGoal1, varargin) |
2 %% | 2 %% |
3 %============================================= | 3 %============================================= |
4 % Sparse coding of a group of signals based on a given | 4 % Sparse coding of a group of signals based on a given |
5 % dictionary and specified number of atoms to use. | 5 % dictionary and specified number of atoms to use. |
6 % input arguments: Dict - the dictionary | 6 % input arguments: Dict - the dictionary |
43 error('Dictionary is of unsupported type. Use explicit matrix, function_handle or object. Exiting.'); | 43 error('Dictionary is of unsupported type. Use explicit matrix, function_handle or object. Exiting.'); |
44 end | 44 end |
45 %% | 45 %% |
46 [n,P]=size(X); | 46 [n,P]=size(X); |
47 | 47 |
48 E2 = errorGoal^2; | 48 %E2 = errorGoal^2; |
49 | 49 |
50 | 50 |
51 A = sparse(m,size(X,2)); | 51 A = sparse(m,size(X,2)); |
52 for k=1:1:P, | 52 for k=1:1:P, |
53 | 53 |
55 residual=x; | 55 residual=x; |
56 indx = []; | 56 indx = []; |
57 j=0; | 57 j=0; |
58 | 58 |
59 currResNorm = norm(residual); | 59 currResNorm = norm(residual); |
60 errorGoal=errorGoal*currResNorm; | 60 errorGoal=errorGoal1*currResNorm; |
61 | 61 |
62 a = zeros(m,1); | 62 a = zeros(m,1); |
63 | 63 |
64 | 64 |
65 while currResNorm>errorGoal & j < maxNumCoef, | 65 while currResNorm>errorGoal & j < maxNumCoef, |