You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I got a problem when I'm trying to use Symbolics.jl and TensorOperations.jl together. tensortrace not working on Arrays of Symbolic Expressions from Symbolics.jl.
I checked out the issue, and it seems like the root is an ambiguity related to VectorInterface. This package defines a "hard zero" Zero and "hard one" One, and these method definitions are ambiguous with the ones defined in Symbolics for Num. I am not entirely sure where to add the fix, and maybe some package extension for VectorIterface-Symbolics is necessary at some point, but you should be able to at least locally resolve the issue by just defining the following methods:
# point ambigous methods to the ones defined in VectorInterfaceusing Symbolics: Num
using TensorOperations: One, Zero # alternatively: using VectorInterface: One, Zero
Base.:*(x::Num, y::One) =invoke(Base.:*, Tuple{Number, One}, x, y)
Base.:*(x::One, y::Num) =invoke(Base.:*, Tuple{One, Number}, x, y)
Base.:*(x::Num, y::Zero) =invoke(Base.:*, Tuple{Number, Zero}, x, y)
Base.:*(x::Zero, y::Num) =invoke(Base.:*, Tuple{Zero, Number}, x, y)
After which your example runs on my machine. Feel free to let me know if you encounter any more issues :)
Hi, I got a problem when I'm trying to use Symbolics.jl and TensorOperations.jl together.
tensortrace
not working on Arrays of Symbolic Expressions from Symbolics.jl.Minimal code reproduces the error:
which gives out
The text was updated successfully, but these errors were encountered: