view general/numerical/alpha_norm.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +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));