diff DL/Majorization Minimization DL/ExactDicoRecovery/dict_update_KSVD_cn.m @ 155:b14209313ba4 ivand_dev

Integration of Majorization Minimisation Dictionary Learning
author Ivan Damnjanovic lnx <ivan.damnjanovic@eecs.qmul.ac.uk>
date Mon, 22 Aug 2011 11:46:35 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DL/Majorization Minimization DL/ExactDicoRecovery/dict_update_KSVD_cn.m	Mon Aug 22 11:46:35 2011 +0100
@@ -0,0 +1,22 @@
+function[Phiout,unhatnz] = dict_update_KSVD_cn(Phi,x,unhat)
+%% K-SVD Dictionary Learning with the constraint on the column norms %%%%%
+
+%%
+unhatn = unhat;
+rPerm = randperm(size(Phi,2));
+%% for l = 1:size(Phi,2),
+for l = rPerm
+    unhatns = unhat;
+    unhatns(l,:) = zeros(1,size(unhat,2));
+    E = x-Phi*unhatns;
+    ER = E(:,(abs(unhat(l,:))>0));
+    [U,S,V] = svd(ER,0);
+    Phi(:,l) = U(:,1)
+    unhatn(l,:) = zeros(1,size(unhat,2));
+    unhatn(l,(abs(unhat(l,:))>0)) = S(1,1)*V(:,1);
+    unhat = unhatn;
+end
+%%
+unhatnz = unhat;
+Phiout = Phi;
+end
\ No newline at end of file