diff util/SMALL_learn.m @ 152:485747bf39e0 ivand_dev

Two step dictonary learning - Integration of the code for dictionary update and dictionary decorrelation from Boris Mailhe
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Thu, 28 Jul 2011 15:49:32 +0100
parents 5ded5e2e7d07
children b14209313ba4
line wrap: on
line diff
--- a/util/SMALL_learn.m	Tue Jul 26 16:01:17 2011 +0100
+++ b/util/SMALL_learn.m	Thu Jul 28 15:49:32 2011 +0100
@@ -18,8 +18,9 @@
 %   License, or (at your option) any later version.  See the file
 %   COPYING included with this distribution for more information.
 %%
- 
+if (DL.profile)
   fprintf('\nStarting Dictionary Learning %s... \n', DL.name);
+end
   start=cputime;
   tStart=tic;
   if strcmpi(DL.toolbox,'KSVD')
@@ -58,6 +59,17 @@
         D(:,i)=D(:,i)/norm(D(:,i));
     end
     
+   elseif strcmpi(DL.toolbox,'TwoStepDL')
+        
+    DL=SMALL_two_step_DL(Problem, DL);
+    
+    %   we need to make sure that columns are normalised to
+    %   unit lenght.
+    
+    for i = 1: size(DL.D,2)
+        DL.D(:,i)=DL.D(:,i)/norm(DL.D(:,i));
+    end
+    D = DL.D; 
 %   To introduce new dictionary learning technique put the files in
 %   your Matlab path. Next, unique name <TolboxID> for your toolbox needs 
 %   to be defined and also prefferd API for toolbox functions <Preffered_API>
@@ -83,9 +95,11 @@
 %%
 %   Dictionary Learning time
 tElapsed=toc(tStart);
-  DL.time = cputime - start;
+DL.time = cputime - start;
+if (DL.profile)
   fprintf('\n%s finished task in %2f seconds (cpu time). \n', DL.name, DL.time);
   fprintf('\n%s finished task in %2f seconds (tic-toc time). \n', DL.name, tElapsed);
+end
 DL.time=tElapsed;
 %   If dictionary is given as a sparse matrix change it to full