@@ -695,6 +695,7 @@ function SciMLBase.SCCNonlinearProblem{iip}(sys::NonlinearSystem, u0map,
695
695
scc_cachevars = Dict{TypeT, Vector{Any}}[]
696
696
scc_cacheexprs = Dict{TypeT, Vector{Any}}[]
697
697
scc_eqs = Vector{Equation}[]
698
+ scc_obs = Vector{Equation}[]
698
699
for (i, (escc, vscc)) in enumerate (zip (eq_sccs, var_sccs))
699
700
# subset unknowns and equations
700
701
_dvs = dvs[vscc]
@@ -708,10 +709,8 @@ function SciMLBase.SCCNonlinearProblem{iip}(sys::NonlinearSystem, u0map,
708
709
# get all subexpressions in the RHS which we can precompute in the cache
709
710
# precomputed subexpressions should not contain `banned_vars`
710
711
banned_vars = Set {Any} (vcat (_dvs, getproperty .(_obs, (:lhs ,))))
711
- for var in banned_vars
712
- iscall (var) || continue
713
- operation (var) === getindex || continue
714
- push! (banned_vars, arguments (var)[1 ])
712
+ filter! (banned_vars) do var
713
+ symbolic_type (var) != ArraySymbolic () || all (x -> var[i] in banned_vars, eachindex (var))
715
714
end
716
715
state = Dict ()
717
716
for i in eachindex (_obs)
@@ -762,15 +761,15 @@ function SciMLBase.SCCNonlinearProblem{iip}(sys::NonlinearSystem, u0map,
762
761
push! (scc_cachevars, cachevars)
763
762
push! (scc_cacheexprs, cacheexprs)
764
763
push! (scc_eqs, _eqs)
764
+ push! (scc_obs, _obs)
765
765
blockpush! (prevobsidxs, obsidxs)
766
766
end
767
767
768
768
for (i, (escc, vscc)) in enumerate (zip (eq_sccs, var_sccs))
769
769
_dvs = dvs[vscc]
770
770
_eqs = scc_eqs[i]
771
- obsidxs = prevobsidxs[Block (i)]
772
771
_prevobsidxs = reduce (vcat, blocks (prevobsidxs)[1 : (i - 1 )]; init = Int[])
773
- _obs = obs[obsidxs ]
772
+ _obs = scc_obs[i ]
774
773
cachevars = scc_cachevars[i]
775
774
cacheexprs = scc_cacheexprs[i]
776
775
0 commit comments