[Numpy-discussion] block matrix and sums of blocks

Xavier Gnata xavier.gnata@gmail....
Sun Feb 22 19:39:34 CST 2009


Hi,

Let us consider one kN x kM array.
What is the fastest way to sum each k x k square block of A and to put 
all these results into a NxM array B?

For instance:
If A =
[112233
 112233
 223311
 223311]
then B =
[4 8 12
 4 12 4]

No sanity checks on the arrays shapes are requiered. Only speed matters ;)

Xavier


More information about the Numpy-discussion mailing list