title: fast way to invert or dot kxnxn matrix
body: <p>Is there a fast way to calculate the inverse of a kxnxn matrix using numpy (the inverse being calculated at each k-slice)? In other words, is there a way to <em>vectorize</em> the following code:</p>
  
  <pre><code>&gt;&gt;&gt;from numpy.linalg import inv
  &gt;&gt;&gt;a-random(4*2*2).reshape(4,2,2)
  &gt;&gt;&gt;b=a.copy()
  &gt;&gt;&gt;for k in range(len(a)):
  &gt;&gt;&gt;    b[k,:,:] = inv(a[k,:,:])
  </code></pre>