function z = l1overl2(X)
%L1OVERL2 ratio between the l1 and the l2 norms.
%
% 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.
%
% ----------------------------------------------------------- %
%  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
end

z(isnan(z)) = [];
z = mean(z);

%EOF