diff DL/two-step DL/SMALL_two_step_DL.m @ 156:a4d0977d4595 danieleb

First branch commit, danieleb
author danieleb
date Tue, 30 Aug 2011 11:12:31 +0100
parents af307f247ac7
children 88578ec2f94a
line wrap: on
line diff
--- a/DL/two-step DL/SMALL_two_step_DL.m	Fri Jul 29 12:35:52 2011 +0100
+++ b/DL/two-step DL/SMALL_two_step_DL.m	Tue Aug 30 11:12:31 2011 +0100
@@ -76,7 +76,7 @@
 end
 % determine if we should do decorrelation in every iteration  %
 
-if isfield(DL.param,'coherence')
+if isfield(DL.param,'coherence') && isscalar(DL.param.coherence)
     decorrelate = 1;
     mu = DL.param.coherence;
 else
@@ -108,13 +108,20 @@
 % main loop %
 
 for i = 1:iternum
+    disp([num2str(i) '/' num2str(iternum)]);
     Problem.A = dico;
     solver = SMALL_solve(Problem, solver);
     [dico, solver.solution] = dico_update(dico, sig, solver.solution, ...
         typeUpdate, flow, learningRate);
-    if (decorrelate)
-        dico = dico_decorr(dico, mu, solver.solution);
-    end
+    dico = normcols(dico);
+        switch DL.param.decFcn
+            case 'mailhe'
+                dico = dico_decorr(dico, mu, solver.solution);
+            case 'tropp'
+                [n m] = size(dico);
+                dico = grassmanian(n,m,[],[],[],dico,true);
+            otherwise
+        end
     
    if ((show_dictionary)&&(mod(i,show_iter)==0))
        dictimg = SMALL_showdict(dico,[8 8],...
@@ -139,4 +146,4 @@
   Y(blockids) = sum(X(:,blockids).^2);
 end
 
-end
\ No newline at end of file
+end