diff general/numerical/alpha_norm.m @ 4:e44f49929e56

Adding reorganised general toolbox, now in several subdirectories.
author samer
date Sat, 12 Jan 2013 19:21:22 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/numerical/alpha_norm.m	Sat Jan 12 19:21:22 2013 +0000
@@ -0,0 +1,12 @@
+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));                                
+