GEMM using Numpy einsum
<p>Can a single numpy einsum statement replicate <a href="https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3" rel="nofollow">gemm</a> functionality?  Scalar and matrix multiplication seem straightforward, but I haven't found how to get the "+" working.  In case its simpler, D = alpha * A * B + beta * C would be acceptable (preferable actually)</p>

<pre><code>alpha = 2
beta = 3
A = np.arange(9).reshape(3, 3)
B = A + 1
C = B + 1

left_part = alpha*np.dot(A, B)
print(left_part)
left_part = np.einsum(',ij,jk-&gt;ik', alpha, A, B)
print(left_part)
</code></pre>