title: Additional information on numpy.einsum()
body: <p>I am trying to understand numpy.einsum() function but the documentation as well as <a href="https://stackoverflow.com/questions/26089893/understanding-numpys-einsum">this answer</a> from stackoverflow still leave me with some questions.</p>
  
  <p>Let's take the einstein sum and the matrices defined in the answer.</p>
  
  <pre><code>A = np.array([0, 1, 2])
  
  B = np.array([[ 0,  1,  2,  3],
                    [ 4,  5,  6,  7],
                    [ 8,  9, 10, 11]])
  
  np.einsum('i,ij-&gt;i', A, B)
  </code></pre>
  
  <p>So, based on my understanding of einstein sum, I would translate this function to be equivalent to the notation (A_i*B_ij) so I would obtain :</p>
  
  <p>j = 1 : A_1*B_11 + A_2*B_21 + A_3*B_31</p>
  
  <p>j = 2 : A_1*B_12 + A_2*B_22+ A_3*B_32</p>
  
  <p>and so on until j = 4. This gives</p>
  
  <p>j = 1 : 0 + 4 + 16</p>
  
  <p>j = 2 : 0 + 5 + 18</p>
  
  <p>which would be the einstein summation according to my understanding. Instead, the function does not perform the overall sum but stores the separate term in a matrix where we can spot the results of the (A_i * B_ij)</p>
  
  <pre><code>0   0   0   0
  4   5   6   7
  16  18  20  22
  </code></pre>
  
  <p>How is this actually controlled by the function ? I feel this is controlled by the output labels as mentionned in the documentation : </p>
  
  <blockquote>
    <p>The output can be controlled by specifying output subscript labels as
    well. This specifies the label order, and allows summing to be
    disallowed or forced when desired</p>
  </blockquote>
  
  <p>so somehow I assume that putting <code>-&gt;i</code> disables summing of the inner sums. But how does this work exactly ? This is not clear for me. Putting <code>-&gt;j</code> provides the actual einstein sum as expected. </p>