Skip to content

Memory-efficient weighted sum over JAXSparse array #16057

Answered by jakevdp
quattro asked this question in General
Discussion options

You must be logged in to vote

Actually, I suspect that G ** 2 will be much better performance-wise than G, G: the reason is that in your einsum statement, G, G essentially ends up computing G * G, and element-wise multiplication between two sparse matrices requires a set intersection operation between the specified indices of the matrices. By contrast, G ** 2 is basically a single vectorized operation over the defined data, which should be much faster.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jakevdp
Comment options

Answer selected by quattro
@quattro
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants