<br><br><div class="gmail_quote">On Sun, Feb 22, 2009 at 6:39 PM, Xavier Gnata <span dir="ltr"><<a href="mailto:xavier.gnata@gmail.com">xavier.gnata@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
Let us consider one kN x kM array.<br>
What is the fastest way to sum each k x k square block of A and to put<br>
all these results into a NxM array B?<br>
<br>
For instance:<br>
If A =<br>
[112233<br>
 112233<br>
 223311<br>
 223311]<br>
then B =<br>
[4 8 12<br>
 4 12 4]<br>
<br>
No sanity checks on the arrays shapes are requiered. Only speed matters ;)<br>
</blockquote><div><br>An example with real numpy arrays would help ;) But basically you will need to reshape the matrix and sum along the last axis.<br><br>Chuck <br></div></div><br>