I have a 2x3 matrix m = [1.1, 2.0, 0.5 ; 0.9, 1.5, 1.1];
. I need to compute a cumulative geometric mean along the second dimension, i.e. the resulting matrix results
must also have the same dimension (2x3). It's basically comparable to using cumprod
with the extensions that I need to take the 1/n power where n
is the column number.
results
must look like this:
[(1.1)^(1/1), (1.1 * 2.0)^(1/2), (1.1 * 2.0 * 0.5)^(1/3) ;
(0.9)^(1/1), (0.9 * 1.5)^(1/2), (0.9 * 1.5 * 1.1)^(1/3)]
results = cumprod(m,2)
delivers the multiplication components. However, what's the most clever way in order to take the appropriate powers?