Open brandongc opened 3 years ago
Hi Brandon, I think that would be a great addition to stdlib.
Have you seen the lecture from Patrick Seewald (@pseewald) at FortranCon? (the PDF can be found here, and a recording is available on Youtube)
Example code is in the repository: https://github.com/pseewald/fortran-einsum-example
His API uses arrays of integers for the indices, but I guess its possible to create a small parser which translates the index character string to integer indexes, and stops execution in case the user requests an invalid contraction.
A sparse tensor contraction API is part of the DBCSR (https://github.com/cp2k/dbcsr) library.
Thanks for the pointer! I had not seen that talk or code.
Just found a nice Julia package called OMEinsum.jl which can also serve as interface inspiration.
NumPy has a convenient Einstein summation capability numpy.einsum. Any interest in an API which operated in a similar way? ie
Optionals:
"optimize" optional argument from NumPy's API i.e.
Comments: High performance implementations could be realized with libraries such as cuTENSOR