title: Mapping functions of 2D numpy arrays
body: <p>I have a function <code>foo</code> that takes a NxM numpy array as an argument and returns a scalar value.  I have a AxNxM numpy array <code>data</code>, over which I'd like to map <code>foo</code> to give me a resultant numpy array of length A.</p>
  
  <p>Curently, I'm doing this:</p>
  
  <pre><code>result = numpy.array([foo(x) for x in data])
  </code></pre>
  
  <p>It works, but it seems like I'm not taking advantage of the numpy magic (and speed). Is there a better way?</p>
  
  <p>I've looked at <code>numpy.vectorize</code>, and <code>numpy.apply_along_axis</code>, but neither works for a function of 2D arrays.</p>
  
  <p>EDIT: I'm doing boosted regression on 24x24 image patches, so my AxNxM is something like 1000x24x24. What I called <code>foo</code> above applies a Haar-like feature to a patch (so, not terribly computationally intensive).</p>