changeset 3:01cad25206d6

(none)
author idamnjanovic
date Fri, 05 Mar 2010 12:31:22 +0000
parents 257c289bf11d
children 2d7d8736ce6c
files solvers/SMALL_MP.m solvers/SMALL_cgp.m
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/solvers/SMALL_MP.m	Fri Mar 05 12:23:57 2010 +0000
+++ b/solvers/SMALL_MP.m	Fri Mar 05 12:31:22 2010 +0000
@@ -1,4 +1,4 @@
-function [A]=SMALL_MP(Dict,X, m, maxNumCoef, errorGoal1, varargin) 
+function [A]=SMALL_MP(Dict,X, m, maxNumCoef, errorGoal, varargin) 
 %%
 %=============================================
 % Sparse coding of a group of signals based on a given 
@@ -57,12 +57,12 @@
 	j=0;
     
 	currResNorm = norm(residual);
-    errorGoal=errorGoal1*currResNorm;
+    errGoal=errorGoal*currResNorm;
 	
     a = zeros(m,1);
 
 
-    while currResNorm>errorGoal & j < maxNumCoef,
+    while currResNorm>errGoal && j < maxNumCoef,
 		
         j = j+1;
         dir=Dt(residual);
--- a/solvers/SMALL_cgp.m	Fri Mar 05 12:23:57 2010 +0000
+++ b/solvers/SMALL_cgp.m	Fri Mar 05 12:31:22 2010 +0000
@@ -1,4 +1,4 @@
-function [A]=SMALL_cgp(Dict,X, m,  maxNumCoef, errorGoal, varargin) 
+function [A, resF]=SMALL_cgp(Dict,X, m,  maxNumCoef, errorGoal, varargin) 
 %=============================================
 % Sparse coding of a group of signals based on a given 
 % dictionary and specified number of atoms to use. 
@@ -59,7 +59,7 @@
    
 	
     currResNorm = residual'*residual/n;
-    errorGoal=errorGoal*currResNorm;
+    errGoal=errorGoal*currResNorm;
     a = zeros(m,1);
     p = zeros(m,1);
     
@@ -88,12 +88,13 @@
         residual=residual-alfa*Dp;
     
 		currResNorm = residual'*residual/n;
-        if currResNorm<errorGoal
+        if currResNorm<errGoal
             fprintf('\nFound exact representation! \n');
             break;
         end
    end;
    if (~isempty(indx))
+       resF(k)=currResNorm;
        A(indx,k)=a(indx);
    end
 end;