Mercurial > hg > smallbox
comparison util/classes/dictionaryMatrices/grassmannian.m @ 170:68fb71aa5339 danieleb
Added dictionary decorrelation functions and test script for Letters paper.
author | Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk> |
---|---|
date | Thu, 06 Oct 2011 14:33:41 +0100 |
parents | 290cca7d3469 |
children |
comparison
equal
deleted
inserted
replaced
169:290cca7d3469 | 170:68fb71aa5339 |
---|---|
10 %% Parameters and Defaults | 10 %% Parameters and Defaults |
11 error(nargchk(2,7,nargin)); | 11 error(nargchk(2,7,nargin)); |
12 | 12 |
13 if ~exist('verb','var') || isempty(verb), verb = false; end %verbose output | 13 if ~exist('verb','var') || isempty(verb), verb = false; end %verbose output |
14 if ~exist('initA','var') || isempty(initA), initA = randn(n,m); end %initial matrix | 14 if ~exist('initA','var') || isempty(initA), initA = randn(n,m); end %initial matrix |
15 if ~exist('dd2','var') || isempty(dd2), dd2 = 0.99; end %shrinking factor | 15 if ~exist('dd2','var') || isempty(dd2), dd2 = 0.9; end %shrinking factor |
16 if ~exist('dd1','var') || isempty(dd1), dd1 = 0.9; end %percentage of coherences to be shrinked | 16 if ~exist('dd1','var') || isempty(dd1), dd1 = 0.9; end %percentage of coherences to be shrinked |
17 if ~exist('nIter','var') || isempty(nIter), nIter = 10; end %number of iterations | 17 if ~exist('nIter','var') || isempty(nIter), nIter = 10; end %number of iterations |
18 | 18 |
19 %% Main algo | 19 %% Main algo |
20 A = normc(initA); %normalise columns | 20 A = normc(initA); %normalise columns |
40 Geye = G - eye(size(G)); | 40 Geye = G - eye(size(G)); |
41 fprintf(1,'%6i %12.8f %12.8f \n',iIter,muMin,max(abs(Geye(:)))); | 41 fprintf(1,'%6i %12.8f %12.8f \n',iIter,muMin,max(abs(Geye(:)))); |
42 end | 42 end |
43 end | 43 end |
44 | 44 |
45 % [~, Sigma_gram V_gram] = svd(G); %calculate svd decomposition of gramian | |
46 | |
47 % A = normc(A); %normalise dictionary | |
48 | |
49 [V_gram Sigma_gram] = svd(G); %calculate svd decomposition of gramian | 45 [V_gram Sigma_gram] = svd(G); %calculate svd decomposition of gramian |
50 Sigma_new = sqrt(Sigma_gram(1:n,:)).*sign(Sigma); %calculate singular values of dictionary | 46 Sigma_new = sqrt(Sigma_gram(1:n,:)).*sign(Sigma); %calculate singular values of dictionary |
51 A = Uinit*Sigma_new*V_gram'; %update dictionary | 47 A = Uinit*Sigma_new*V_gram'; %update dictionary |
52 | |
53 % param.step = 0.01; | |
54 % param.reg = 0.01; | |
55 % param.nIter = 20; | |
56 % A = rotatematrix(initA,A,'linesearchlie',param); | |
57 | |
58 % %% Debug visualization function | |
59 % function plotcart2d(A) | |
60 % compass(A(1,:),A(2,:)); |