OMEinsum.jl
OMEinsum.jl copied to clipboard
Can't include constants in expression
It seems that the @ein
macro doesn't like having constants included. Interestingly it seems to throw a different error depending on whether you're multiplying or adding.
x = rand(10, 10)
@ein y[i] := x[i, j] * 2
Gives:
LoadError: type Nothing has no field inds
in expression starting at /home/sfr/research_journal/2020/02/26/spatial_subspace_sdr.jmd:177
getproperty(::Nothing, ::Symbol) at Base.jl:20
(::OMEinsum.var"#78#80")(::Nothing) at einsequence.jl:147
...
x = rand(10, 10)
@ein y[i] := x[i, j] + 2
gives
LoadError: type Nothing has no field iy
in expression starting at /home/sfr/research_journal/2020/02/26/spatial_subspace_sdr.jmd:177
getproperty(::Nothing, ::Symbol) at Base.jl:20
#_nested_ein_macro#74(::Symbol, ::typeof(OMEinsum._nested_ein_macro), ::Expr) at einsequence.jl:136
_nested_ein_macro at einsequence.jl:121 [inlined]
#_ein_macro#69(::Symbol, ::typeof(OMEinsum._ein_macro), ::Expr) at interfaces.jl:157
...
Addition is actually not supported so we probably should throw an error there (not sure what happens under the hood there but I'll look at it).
The issue with the constant is a bit unfortunate and it should probably work.
I do not think we will have scalar in the einsum expression in near future.