File tree Expand file tree Collapse file tree 1 file changed +9
-20
lines changed Expand file tree Collapse file tree 1 file changed +9
-20
lines changed Original file line number Diff line number Diff line change @@ -823,30 +823,19 @@ Counteracts the CSE/array variable hacks in `symbolics_tearing.jl` so it works w
823823initialization.
824824"""
825825function unhack_observed (obseqs:: Vector{Equation} , eqs:: Vector{Equation} )
826- subs = Dict ()
827- tempvars = Set ()
828- rm_idxs = Int[]
826+ subs = Dict {SymbolicT, SymbolicT} ()
827+ mask = trues (length (obseqs))
829828 for (i, eq) in enumerate (obseqs)
830- iscall (eq. rhs) || continue
831- if operation (eq. rhs) == StructuralTransformations. change_origin
832- push! (rm_idxs, i)
833- continue
834- end
835- end
836-
837- for (i, eq) in enumerate (obseqs)
838- if eq. lhs in tempvars
839- subs[eq. lhs] = eq. rhs
840- push! (rm_idxs, i)
841- end
829+ mask[i] = ! iscall (eq. rhs) || operation (eq. rhs) != = StructuralTransformations. change_origin
842830 end
843831
844- obseqs = obseqs[setdiff ( eachindex (obseqs), rm_idxs) ]
845- obseqs = map (obseqs) do eq
846- fixpoint_sub (eq . lhs, subs) ~ fixpoint_sub (eq . rhs , subs)
832+ obseqs = obseqs[mask ]
833+ for i in eachindex (obseqs)
834+ obseqs[i] = fixpoint_sub (obseqs[i] . lhs, subs) ~ fixpoint_sub (obseqs[i] , subs)
847835 end
848- eqs = map (eqs) do eq
849- fixpoint_sub (eq. lhs, subs) ~ fixpoint_sub (eq. rhs, subs)
836+ eqs = copy (eqs)
837+ for i in eachindex (eqs)
838+ eqs[i] = fixpoint_sub (eqs[i]. lhs, subs) ~ fixpoint_sub (eqs[i], subs)
850839 end
851840 return obseqs, eqs
852841end
You can’t perform that action at this time.
0 commit comments