annotate DL/Majorization Minimization DL/ExactDicoRecovery/mapfn.m @ 217:8b3c71bb44eb
luisf_dev
Removed "clear all" from example scripts (subs by "clear" instead)
author |
luisf <luis.figueira@eecs.qmul.ac.uk> |
date |
Thu, 22 Mar 2012 14:41:04 +0000 |
parents |
b14209313ba4 |
children |
|
rev |
line source |
ivan@155
|
1 %% Maximum A Posteriori Dictionary Learning with the constraint on the column norms %%%%%
|
ivan@155
|
2 function [Phiout,unhatnz] = mapfn(Phi,x,unhat,mu,maxIT,eps,phim,res)
|
ivan@155
|
3 K = Phi;
|
ivan@155
|
4 B = zeros(size(Phi,1),size(Phi,2));
|
ivan@155
|
5 i = 1;
|
ivan@155
|
6 while (sum(sum((B-K).^2))>eps)&&(i<=maxIT)
|
ivan@155
|
7 B = K;
|
ivan@155
|
8 E = x-K*unhat;
|
ivan@155
|
9 K = K+mu*(phim*E*unhat'-trace(unhat*E'*K)*K);
|
ivan@155
|
10 i = i+1;
|
ivan@155
|
11 end
|
ivan@155
|
12 %%% depleted atoms cancellation %%%
|
ivan@155
|
13 [Y,I] = sort(sum(K.^2),'descend');
|
ivan@155
|
14 RR = phim;
|
ivan@155
|
15 Phiout = K(:,I(1:RR));
|
ivan@155
|
16 unhatnz = unhat(I(1:RR),:); |