Mercurial > hg > lots
diff l1overl2.m @ 4:e23a23349e31
Added inverse transform
author | danieleb@code.soundsoftware.ac.uk |
---|---|
date | Thu, 16 Jun 2011 13:16:29 +0100 |
parents | ee2a86d7ec07 |
children |
line wrap: on
line diff
--- a/l1overl2.m Wed Jun 15 11:26:03 2011 +0100 +++ b/l1overl2.m Thu Jun 16 13:16:29 2011 +0100 @@ -1,33 +1,27 @@ function z = l1overl2(X) -%L1OVERL2 ratio between the l1 and the l2 norms. +%L1OVERL2 ratio between l1 and l2 norm % -% z = l1overl2(X) +% USAGE +% z = l1overl2(x) % -% computes the ratio between the l1 and the l2 norm of the input X. If -% input is a matrix, the norms are calculated along the columns and a mean -% value is returned. If the input is a cell, the norms are calculated -% independently for each cell entry and a mean value is returned. +% INPUT +% x: input vector or matrix. If matrix, the function acts columnwise +% returning one value for each column. % -% ----------------------------------------------------------- % -% Daniele Barchiesi, daniele.barchiesi@eecs.qmul.ac.uk % -% Centre for Digital Music, Queen Mary University of London % -% Apr. 2011 % -% ----------------------------------------------------------- % -if iscell(X) - nCols = length(X); - z = zeros(nCols,1); - for i=1:nCols - z(i) = norm(X{:,i},1)/norm(X{:,i},2); - end -else - nCols = size(X,2); - z = zeros(nCols,1); - for i=1:nCols - z(i) = norm(X(:,i),1)/norm(X(:,i),2); - end +% OUTPUT +% z: the ratio ||x||_1/||x||_2 +% +% SEE ALSO +% NORM + +% Author(s): Daniele Barchiesi +% Copyright QMUL +% $Revision: 1 + +nCols = size(X,2); +z = zeros(nCols,1); +for i=1:nCols + z(i) = norm(X(:,i),1)/norm(X(:,i),2); end -z(isnan(z)) = []; -z = mean(z); - %EOF \ No newline at end of file