Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/indexnotation/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ function tensorify(ex::Expr)
end
if isassignment(ex)
if ex.head == :(=)
return instantiate(dst, false, rhs, true, leftind, rightind)
return Expr(:(=), dst,instantiate(dst, false, rhs, true, leftind, rightind))
elseif ex.head == :(+=)
return instantiate(dst, true, rhs, 1, leftind, rightind)
return Expr(:(=), dst,instantiate(dst, true, rhs, 1, leftind, rightind))
else
return instantiate(dst, true, rhs, -1, leftind, rightind)
return Expr(:(=), dst,instantiate(dst, true, rhs, -1, leftind, rightind))
end
else
return Expr(:(=), dst, instantiate(nothing, false, rhs, true, leftind, rightind, false))
Expand Down
2 changes: 1 addition & 1 deletion src/indexnotation/preprocessors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function extracttensorobjects(ex::Expr)
tensordict = Dict{Any,Any}(a => gensym() for a in alltensors)
pre = Expr(:block, [Expr(:(=), tensordict[a], a) for a in existingtensors]...)
ex = replacetensorobjects((obj,leftind,rightind)->get(tensordict, obj, obj), ex)
post = Expr(:block, [Expr(:(=), a, tensordict[a]) for a in newtensors]...)
post = Expr(:block, [Expr(:(=), a, tensordict[a]) for a in unique!(vcat(newtensors,outputtensors))]...)
pre2 = Expr(:macrocall, Symbol("@notensor"), LineNumberNode(@__LINE__, Symbol(@__FILE__)), pre)
post2 = Expr(:macrocall, Symbol("@notensor"), LineNumberNode(@__LINE__, Symbol(@__FILE__)), post)
return Expr(:block, pre2, ex, post2)
Expand Down