From: Masahiro Tanaka Date: 2010-03-10T22:23:07+09:00 Subject: Re: Calculation of means in Narray objects If you mean [0,0,0],[0,0,10],[0,0,20]...[0,0,90], try narray.reshape(10,10,10,10).mean(3) Milo Thurston wrote: > I'm trying to perform some calculations on data held in NArray objects > but it is not entirely clear to me how this ought to be done (I've > looked here: http://narray.rubyforge.org/SPEC.en). The data consist of > 3-dimensional arrays, e.g. 10x10x100 elements. What I'd like to do is > calculate the means for the data at each for each of the first two > dimensions for positions of the third dimension. For example, 1,11,21... > then 2,12,22..., 3,13,23... &c. The end result would be a 10x10x10 array > where position [0,0,0] would contain the mean of the values in > [0,0,0],[0,0,9],[0,0,19]...[0,0,99] of the original array. > If this makes any sense to anyone I'd appreciate any suggestions. -- Posted via http://www.ruby-forum.com/.