title: How do I get the dot product but without the summation
body: <p>consider array's <code>a</code> and <code>b</code></p>
  
  <pre><code>a = np.array([
          [-1, 1, 5],
          [-2, 3, 0]
      ])
  b = np.array([
          [1, 1, 0],
          [0, 2, 3],
      ])
  </code></pre>
  
  <p>Looking at</p>
  
  <pre><code>d = a.T.dot(b)
  d
  
  array([[-1, -5, -6],
         [ 1,  7,  9],
         [ 5,  5,  0]])
  </code></pre>
  
  <p><code>d[0, 0]</code> is <code>-1</code>.  and is the sum of <code>a[:, 0] * b[:, 0]</code>.  I'd like a 2x2 array of vectors where the <code>[0, 0]</code> position would be <code>a[:, 0] * b[:, 0]</code>.</p>
  
  <p>with the above <code>a</code> and <code>b</code>, I'd expect</p>
  
  <pre><code>d = np.array([[a[:, i] * b[:, j] for j in range(a.shape[1])] for i in range(b.shape[1])])
  
  d
  
  array([[[-1,  0],
          [-1, -4],
          [ 0, -6]],
  
         [[ 1,  0],
          [ 1,  6],
          [ 0,  9]],
  
         [[ 5,  0],
          [ 5,  0],
          [ 0,  0]]])
  </code></pre>
  
  <p>The sum of <code>d</code> along <code>axis==2</code> should be the dot product <code>a.T.dot(b)</code></p>
  
  <pre><code>d.sum(2)
  
  array([[-1, -5, -6],
         [ 1,  7,  9],
         [ 5,  5,  0]])
  </code></pre>
  
  <h3>Question</h3>
  
  <p>What is the most efficient way of getting <code>d</code>?</p>