Skip to content

Commit

Permalink
evaluate double indexed variables fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophHotter committed Aug 15, 2023
1 parent 29e4061 commit 289f8ae
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/index_average.jl
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,16 @@ function insert_index(term_::BasicSymbolic{DoubleIndexedVariable},ind::Index,val
return term_
end
function insert_index(term::BasicSymbolic{DoubleNumberedVariable},ind::Index,value::Int64)
if istree(term)
op = operation(term)
if op === *
return prod(insert_index(arg,ind,value) for arg in arguments(term))
elseif op === +
return sum(insert_index(arg,ind,value) for arg in arguments(term))
elseif op === ^
return insert_index(arguments(term)[1],ind,value)^(arguments(term)[2])
end
end
data = SymbolicUtils.metadata(term)[DoubleNumberedVariable]
if data.numb1 isa Index && data.numb1 == ind
return DoubleNumberedVariable(data.name,value,data.numb2)
Expand Down

0 comments on commit 289f8ae

Please sign in to comment.