diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/classes/util/regularisedictionary.m	Wed Aug 31 10:53:10 2011 +0100
@@ -0,0 +1,41 @@
+function Dreg = regularisedictionary(D)
+% REGULARISEDICTIONARY regularise dictionary for sparse representation
+%
+% Example
+% Dreg = regularisedictionary(D)
+%
+% Input
+% - D: initial dictionary matrix.
+%
+% Output
+% - Dreg: regularised dictionary
+%
+% References:
+%
+% See also
+
+% Author(s): Daniele Barchiesi
+% Copyright 2011-2011
+
+[n m] = size(D);	%dimension and number of atoms
+[U S V] = svd(D);	%SVD decomposition of the dictionary
+G = V*(S'*S)*V';	%gram matrix (equivalent to D'*D)
+I = eye(m);			%identity matrix
+lambda = 1;		    %regularisation coefficient
+
+% Optimise the gram matrix
+cvx_begin							%start cvx optimisation problem
+	variable Greg(m,m) symmetric;	%declare optimisation variable to be an mxm symmetric matrix
+	expression residual(m,m)		%declare residual as an intermediate calculation step
+	residual = G-Greg;				%define residual
+	minimise (max(max(abs(Greg-I))));	%define objective function
+	subject to						%declare constraints
+		Greg == semidefinite(m);	%positive semidefinite cone membership
+		diag(Greg) == ones(m,1);	%unit diagonal
+		norm(residual,'fro') <= lambda;	%
+cvx_end
+
+[~, Sgram Vgram] = svd(Greg);		%SVD decomposition of gramian
+Snew = sqrt(Sgram(1:n,:)).*sign(S); %calculate singular values of the regularised dictionary
+Dreg = U*Snew*Vgram';				%calculate regularised dictionary
+Dreg = normc(Dreg);					%normalise columns of regularised dictionary