comparison util/classes/util/regularisedictionary.m @ 160:e3035d45d014 danieleb

Added support classes
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Wed, 31 Aug 2011 10:53:10 +0100
parents
children
comparison
equal deleted inserted replaced
159:23763c5fbda5 160:e3035d45d014
1 function Dreg = regularisedictionary(D)
2 % REGULARISEDICTIONARY regularise dictionary for sparse representation
3 %
4 % Example
5 % Dreg = regularisedictionary(D)
6 %
7 % Input
8 % - D: initial dictionary matrix.
9 %
10 % Output
11 % - Dreg: regularised dictionary
12 %
13 % References:
14 %
15 % See also
16
17 % Author(s): Daniele Barchiesi
18 % Copyright 2011-2011
19
20 [n m] = size(D); %dimension and number of atoms
21 [U S V] = svd(D); %SVD decomposition of the dictionary
22 G = V*(S'*S)*V'; %gram matrix (equivalent to D'*D)
23 I = eye(m); %identity matrix
24 lambda = 1; %regularisation coefficient
25
26 % Optimise the gram matrix
27 cvx_begin %start cvx optimisation problem
28 variable Greg(m,m) symmetric; %declare optimisation variable to be an mxm symmetric matrix
29 expression residual(m,m) %declare residual as an intermediate calculation step
30 residual = G-Greg; %define residual
31 minimise (max(max(abs(Greg-I)))); %define objective function
32 subject to %declare constraints
33 Greg == semidefinite(m); %positive semidefinite cone membership
34 diag(Greg) == ones(m,1); %unit diagonal
35 norm(residual,'fro') <= lambda; %
36 cvx_end
37
38 [~, Sgram Vgram] = svd(Greg); %SVD decomposition of gramian
39 Snew = sqrt(Sgram(1:n,:)).*sign(S); %calculate singular values of the regularised dictionary
40 Dreg = U*Snew*Vgram'; %calculate regularised dictionary
41 Dreg = normc(Dreg); %normalise columns of regularised dictionary