title: Nicer way to do nested dot products in numpy?
body: <p>I'm finding this happening to me a lot: I want to compute a matrix multiplication of the sort <code>(X^TX)^{-1}XX^T</code>, or something along these lines. I end up doing something like</p>
  
  <pre><code>X = np.array([[1,2],[3,4]])
  a = np.dot(np.transpose(X), X)
  b = np.dot(np.linalg.inv(a), X)
  answer = np.dot(b, np.transpose(X))
  </code></pre>
  
  <p>Is there a better way to do this without resorting to the <code>np.matrix</code> type? Is there a way to do transpose without typing <code>np.transpose</code>?</p>