Skip to content

Commit bf6faad

Browse files
authored
Merge pull request #110 from maartenvd/master
in-place operations no longer have to be in-place
2 parents dfac501 + fdea72f commit bf6faad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/indexnotation/parser.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ function tensorify(ex::Expr)
103103
end
104104
if isassignment(ex)
105105
if ex.head == :(=)
106-
return instantiate(dst, false, rhs, true, leftind, rightind)
106+
return Expr(:(=), dst,instantiate(dst, false, rhs, true, leftind, rightind))
107107
elseif ex.head == :(+=)
108-
return instantiate(dst, true, rhs, 1, leftind, rightind)
108+
return Expr(:(=), dst,instantiate(dst, true, rhs, 1, leftind, rightind))
109109
else
110-
return instantiate(dst, true, rhs, -1, leftind, rightind)
110+
return Expr(:(=), dst,instantiate(dst, true, rhs, -1, leftind, rightind))
111111
end
112112
else
113113
return Expr(:(=), dst, instantiate(nothing, false, rhs, true, leftind, rightind, false))

src/indexnotation/preprocessors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function extracttensorobjects(ex::Expr)
110110
tensordict = Dict{Any,Any}(a => gensym() for a in alltensors)
111111
pre = Expr(:block, [Expr(:(=), tensordict[a], a) for a in existingtensors]...)
112112
ex = replacetensorobjects((obj,leftind,rightind)->get(tensordict, obj, obj), ex)
113-
post = Expr(:block, [Expr(:(=), a, tensordict[a]) for a in newtensors]...)
113+
post = Expr(:block, [Expr(:(=), a, tensordict[a]) for a in unique!(vcat(newtensors,outputtensors))]...)
114114
pre2 = Expr(:macrocall, Symbol("@notensor"), LineNumberNode(@__LINE__, Symbol(@__FILE__)), pre)
115115
post2 = Expr(:macrocall, Symbol("@notensor"), LineNumberNode(@__LINE__, Symbol(@__FILE__)), post)
116116
return Expr(:block, pre2, ex, post2)

0 commit comments

Comments
 (0)