Mercurial > hg > smallbox
comparison util/classes/@dictionary/cumcoherence.m @ 179:989b7d78e1c8 danieleb
added support for p-cumulative coherence
author | Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk> |
---|---|
date | Thu, 17 Nov 2011 12:55:36 +0000 |
parents | e3035d45d014 |
children | 28b20fd46ba7 |
comparison
equal
deleted
inserted
replaced
178:4ea4badb2266 | 179:989b7d78e1c8 |
---|---|
1 function mu = cumcoherence(obj) | 1 function mu = cumcoherence(obj,p) |
2 % Calculates the p-cumulative coherence of the dictionary, defined as | |
3 % \mu_p(k) = max_|I|=k{max_j\notin I{(\sum_i \in I}|<\phi_i,\phi_j>|^p)^1/p} | |
4 % | |
5 % INPUT | |
6 % obj: dictionary object | |
7 % p: power (default 1) | |
8 % | |
9 % OUTPUT | |
10 % mu: p-cumulative coherence | |
11 if ~exist('type','var') || isempty(p), p = 1; end | |
12 | |
2 obj = normalize(obj); | 13 obj = normalize(obj); |
3 [M N] = size(obj.phi); | 14 [M N] = size(obj.phi); |
4 mu = zeros(M,1); | 15 mu = zeros(M,1); |
5 for m=1:M | 16 for m=1:M |
6 c = zeros(N); | 17 c = zeros(N); |
7 for i=1:N | 18 for i=1:N |
8 c(:,i) = abs(obj.phi'*obj.phi(:,i)); | 19 c(:,i) = abs(obj.phi'*obj.phi(:,i)).^p; |
9 c(i,i) = 0; | 20 c(i,i) = 0; |
10 end | 21 end |
11 c = sort(c,'descend'); | 22 c = sort(c,'descend'); |
12 c = c(1:m,:); | 23 c = c(1:m,:); |
13 if m==1 | 24 if m==1 |
14 mu(m) = max(c); | 25 mu(m) = max(c^(1/p)); |
15 else | 26 else |
16 mu(m) = max(sum(c)); | 27 mu(m) = max(sum(c)^(1/p)); |
17 end | 28 end |
18 end | 29 end |
19 end | 30 end |