[Numpy-discussion] Any numpy trick for my problem ?

Uwe Schmitt rocksportrocker@googlemail....
Wed Oct 15 05:47:53 CDT 2008


Hi,

I got a matrix of 2100 lines, and I want to calculate  blockwise mean
vectors.
Each block consists of 10 consecutive rows.

My code looks like this:

   rv = []
   for i in range(0, 2100, 10):
       rv.append( mean(matrix[i:i+10], axis=0))

   return array(rv)

Is there a more elegant and may be faster method to perform this
calculation ?

Greetings, Uwe


More information about the Numpy-discussion mailing list