4

Numpy's einsum only works with dense tensors.

Is there an alternative that also works with sparse tensors and linear operators?

For example, I might have a function f that computes matrix vector multiplications of the form $A^{-1}x$ for some matrix $A$. Numpy's einsum doesn't even allow

np.einsum('ij,j',A,x)

let alone

np.einsum('ijkl,mj->imkl',X,A)

The same operations also don't work when $A$ is a sparse matrix (let alone a general sparse tensor).

While the LinearOperator support is more of a convenience question, the support for sparse tensors is crucial to me.

Bananach
  • 799
  • 3
  • 13

1 Answers1

2

See the list at Wikipedia and answers to Fast, lightweight C++ tensor library for dimension-agnostic code. Especially taco seems to fit your needs.