dfdx/Espresso.jl

`to_einstein` can't handle guargds

Closed this issue · 1 comments

dfdx commented

Example:

to_einstein(:(z[i,j] = x[i] * y[j] * (i == j)); x=rand(3), y=rand(3)) 

We may want (i == j) to be treated as guards (as in TensorDeriv), which will be very useful for expression parsing.

dfdx commented

What the hell did I mean? Anyway, with new EinGraph we can now parse expressions with guards:

julia> EinGraph(:(z[i,j] = x[i] * y[j] * (i == j)); x=rand(3), y=rand(3))
EinGraph
  ExNode{input}(x = x | <Array{Float64,1}>)
  ExNode{input}(y = y | <Array{Float64,1}>)
  ExNode{call}(z[i, j] = (x[i] * y[j]) * (i == j) | nothing)