diff DL/Majorization Minimization DL/ExactDicoRecovery/mapfn.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/mapfn.m	Mon Aug 22 11:46:35 2011 +0100
@@ -0,0 +1,16 @@
+%% Maximum A Posteriori Dictionary Learning with the constraint on the column norms %%%%%
+function [Phiout,unhatnz] = mapfn(Phi,x,unhat,mu,maxIT,eps,phim,res)
+K = Phi;
+B = zeros(size(Phi,1),size(Phi,2));
+i = 1;
+while (sum(sum((B-K).^2))>eps)&&(i<=maxIT)   
+    B = K;
+    E = x-K*unhat;   
+    K = K+mu*(phim*E*unhat'-trace(unhat*E'*K)*K);
+    i = i+1;
+end
+%%% depleted atoms cancellation %%%
+[Y,I] = sort(sum(K.^2),'descend');
+RR = phim;
+Phiout = K(:,I(1:RR));
+unhatnz = unhat(I(1:RR),:);
\ No newline at end of file