comparison DL/Majorization Minimization DL/dict_update_REG_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
comparison
equal deleted inserted replaced
154:0de08f68256b 155:b14209313ba4
1 function [Phiout,unhatnz] = dict_update_REG_cn(Phi,x,unhat,maxIT,eps,cvset)
2 %% Regularized Dictionary Learning with the constraint on the column norms %%%%%
3 % Phi = Normalized Initial Dictionary
4 % x = Signal(x). This can be a vector or a matrix
5 % unhat = Initial guess for the coefficients
6 % to = 1/(step size) . It is larger than spectral norm of coefficient matrix x
7 % eps = Stopping criterion for iterative softthresholding and MM dictionary update
8 % cvset = Dictionary constraint. 0 = Non convex ||d|| = 1, 1 = Convex ||d||<=1
9 % Phiout = Updated Dictionary
10 % unhatnz Updated Coefficients (the same as input in this version)
11
12 %%
13 B = Phi;
14 K = zeros(size(Phi,1),size(Phi,2));
15 c = .1 + svds(unhat,1)^2; %.1
16 c3 = (1/c)*eye(size(B,2));
17 c1 = x*unhat'*c3;
18 c2 = (c*eye(size(B,2))-unhat*unhat')*c3;
19
20 %%
21
22 for i=1:maxIT
23 % if i>1
24 % B = K;
25 % end
26
27 K = c1 + B*c2;
28
29 if cvset == 1,
30 K = K*diag(min(sum(K.^2).^(-.5),1)); % with convex constraint set
31 else
32 % Mehrdad original -
33 % K = K*diag(sum(K.^2).^(-.5)); % with fixed-norm constraint set
34 K = normc(K);
35 end
36
37 if (sum(sum((B-K).^2)) < eps)
38 break;
39 end
40
41 B = K;
42 end
43 %% depleted atoms cancellation %%%
44 [Y,I] = sort(sum(K.^2),'descend');
45 RR = sum(Y>=.01);
46 Phiout = K(:,I(1:RR));
47 unhatnz = unhat(I(1:RR),:);
48 end