title: Compute sum of pairwise sums of two array's columns
body: <p>I am looking for a way to avoid the nested loops in the following snippet, where <code>A</code> and <code>B</code> are two-dimensional arrays, each of shape <code>(m, n)</code> with <code>m</code>, <code>n</code> beeing arbitray positive integers:</p>
  
  <pre><code>import numpy as np
  
  m, n = 5, 2
  a = randint(0, 10, (m, n))
  b = randint(0, 10, (m, n))
  
  out = np.empty((n, n))
  for i in range(n):
      for j in range(n):
          out[i, j] = np.sum(A[:, i] + B[:, j])
  </code></pre>
  
  <p>The above logic is roughly equivalent to</p>
  
  <pre><code>np.einsum('ij,ik', A, B)
  </code></pre>
  
  <p>with the exception that <code>einsum</code> computes the sum of products.</p>
  
  <p>Is there a way, equivalent to <code>einsum</code>, that computes a sum of sums? Or do I have to write an extension for this operation?</p>