1
function gm=geomean(x,orien)
3
//This function computes the geometric mean of a vector or matrix x.
5
//For a vector or matrix x, gm=geomean(x) returns in scalar gm the
6
//geometric mean of all the entries of x.
8
//gm=geomean(x,'r')(or, equivalently, gm=gmean(x,1)) returns in each
9
//entry of the row vector gm the geometric mean of each column of x.
11
//gm=geomean(x,'c')(or, equivalently, gm=gmean(x,2)) returns in each
12
//entry of the column vector gm the geometric mean of each row of x.
14
//References: Wonacott, T.H. & Wonacott, R.J.; Introductory
15
//Statistics, J.Wiley & Sons, 1990.
17
//author: carlos klimann
21
if x==[] then gm=%nan, return, end
23
if rhs==0 then error('geomean requires at least one input.'), end
25
gm=prod(x)^(1/length(x))
27
gm=prod(x,orien).^(1/size(x,orien))
29
error('The number of input parameters must be 1 or 2')