I think it would be very useful and powerful to include also the support for the computation with symbolic $n$-dimensional arrays based on sympy (see sympy.tensor.array module). To give an explicit example, consider the following code:
import sympy
import numpy
from opt_einsum import contract
arr1 = sympy.Array([[[1,0],[0,0]],
[[0,0],[0,0]]])
arr2 = sympy.Array([[0,1],[1,0]])
output = contract('ijk, kl -> ijl', arr1, arr2)
isinstance(output, sympy.Array) # False
isinstance(output, numpy.ndarray) # True
This is working and it returns the correct result but the output array is a numpy.ndarray with dtype=object which is unnatural and quite inefficient for symbolic computation. It would be nice to have an implementation of the contract function able to operate on sympy.Array objects directly.
Please let me know if this is something planned for the opt_einsum project in the near-term future. Otherwise, it would be great if you could drop here any reference to other possible implementation attempts of that kind of symbolic version of the optimized tensors contraction.
I think it would be very useful and powerful to include also the support for the computation with symbolic$n$ -dimensional arrays based on
sympy(see sympy.tensor.array module). To give an explicit example, consider the following code:This is working and it returns the correct result but the
outputarray is anumpy.ndarraywithdtype=objectwhich is unnatural and quite inefficient for symbolic computation. It would be nice to have an implementation of thecontractfunction able to operate onsympy.Arrayobjects directly.Please let me know if this is something planned for the
opt_einsumproject in the near-term future. Otherwise, it would be great if you could drop here any reference to other possible implementation attempts of that kind of symbolic version of the optimized tensors contraction.