Jutho / TensorOperations.jl

Julia package for tensor contractions and related operations
https://jutho.github.io/TensorOperations.jl/stable/
Other
443 stars 56 forks source link

Using a constant rhs in @tensor #111

Open feanor12 opened 2 years ago

feanor12 commented 2 years ago

Is it possible to assign a constant using the @tensor macro?

Example:

C=zeros(3,3,3)
@tensor begin
    C[i,i,i] = 6
end
Jutho commented 2 years ago

No that is not supported. TensorOperations is rather restricted. It was motivated by physics applications and only handles expressions which can be thought of as being basis independent. I guess alternatives like Tullio.jl are more flexible and probably more useful for general data science / ML applications.