Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 4
    Very nice explanation, thanks. "Notice that i does not appear as a label in our desired output"-- doesn't it? Commented Sep 7, 2016 at 20:14
  • 1
    Thanks @IanHincks! That looks like a typo; I've corrected it now. Commented Sep 18, 2016 at 13:40
  • 2
    Very good answer. It's also worth noting that ij,jk could work by itself (without the arrows) to form the matrix multiplication. But it seems like for clarity it's best to put the arrows and then the output dimensions. It's in the blog post. Commented Dec 28, 2016 at 17:35
  • 2
    @Peaceful: this is one of those occasions where it's difficult to choose the right word! I feel "column" fits a bit better here since A is of length 3, the same as the length of the columns in B (whereas rows of B have length 4 and cannot be multiplied element-wise by A). Commented Jan 15, 2017 at 10:47
  • 5
    Note that omitting the -> affects the semantics: "In implicit mode, the chosen subscripts are important since the axes of the output are reordered alphabetically. This means that np.einsum('ij', a) doesn’t affect a 2D array, while np.einsum('ji', a) takes its transpose." Commented Dec 31, 2019 at 13:18