view general/numerical/alpha_norm.m @ 16:db7f4afd27c5

Rearranging numerical toolbox.
author samer
date Thu, 17 Jan 2013 13:20:44 +0000
parents e44f49929e56
children
line wrap: on
line source
function l=alpha_norm(alpha,x)
% alpha_norm - Minkowski norm (actually more like mean) using given exponent
%
% alpha_norm :: nonneg ~'exponent', [[N,M]] -> [[1,M]->nonneg].
% alpha_norm :: nonneg ~'exponent', [[1,N]] -> nonneg.
%
% This version divides by the dimemnsionality of the space,
% eg
%    alpha_norm(2,x) = sqrt(mean(x.^2,1))
%    alpha_norm(1,x) = mean(abs(x),1))
l=real(mean(abs(x).^alpha).^(1/alpha));