Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Oct 27, 2017
1 parent 0f61b1f commit 49c5502
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/indexnotation/tensormacro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function deindexify!(dst, β, ex::Expr, α, leftind, rightind)
conjA = :(Val{:N})
indA = vcat(oindA, cind)
poA = ((1:length(oindA))...)
pcA = (((length(oindA)+1):(length(oindA)+length(indA)))...)
pcA = ((length(oindA)+1:length(indA))...)
end
if isgeneraltensor(ex.args[3])
B, indBl, indBr, αB, conj = makegeneraltensor(ex.args[3])
Expand All @@ -310,15 +310,15 @@ function deindexify!(dst, β, ex::Expr, α, leftind, rightind)
conjB = :(Val{:N})
indB = vcat(cind, oindB)
pcB = ((1:length(cind))...)
poB = (((length(cind)+1):(length(cind)+length(oindB)))...)
poB = ((length(cind)+1:length(indB))...)
end
oindAB = vcat(oindA, oindB)
p1 = (map(l->findfirst(equalto(l), oindAB), leftind)...)
p2 = (map(l->findfirst(equalto(l), oindAB), rightind)...)

if !(isperm((poA...,pcA...)) && length(indA) == length(poA)+length(pcA)) ||
!(isperm((pcB...,poB...)) && length(indB) == length(poB)+length(pcB)) ||
!(isperm((p1...,p2...))) && length(oindAB) == length(p1)+length(p2)
!(isperm((p1...,p2...)) && length(oindAB) == length(p1)+length(p2))
err = "contraction: $(tuple(leftind..., rightind...)) from $(tuple(indA...)) and $(tuple(indB...)))"
return :(throw(IndexError($err)))
end
Expand Down Expand Up @@ -392,7 +392,7 @@ function deindexify(ex::Expr, leftind, rightind)
conjA = :(Val{:N})
indA = vcat(oindA, cind)
poA = ((1:length(oindA))...)
pcA = (((length(oindA)+1):(length(oindA)+length(indA)))...)
pcA = ((length(oindA)+1:length(indA))...)
end
if isgeneraltensor(ex.args[3]) && !hastraceindices(ex.args[3])
B, indBl, indBr, αB, conj = makegeneraltensor(ex.args[3])
Expand All @@ -406,7 +406,7 @@ function deindexify(ex::Expr, leftind, rightind)
conjB = :(Val{:N})
indB = vcat(cind, oindB)
pcB = ((1:length(cind))...)
poB = (((length(cind)+1):(length(cind)+length(oindB)))...)
poB = ((length(cind)+1:length(indB))...)
end
oindAB = vcat(oindA, oindB)
p1 = (map(l->findfirst(equalto(l), oindAB), leftind)...)
Expand Down

0 comments on commit 49c5502

Please sign in to comment.