Skip to content

Commit

Permalink
Merge pull request #101 from baggepinnen/patch-1
Browse files Browse the repository at this point in the history
performance improvement in state_indexing
  • Loading branch information
AayushSabharwal authored Oct 15, 2024
2 parents 742dc91 + eea20ba commit 5249fbb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/state_indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ for (t1, t2) in [
return MultipleGetters(ContinuousTimeseries(), sym)
end
sym_arr = sym isa Tuple ? collect(sym) : sym
num_observed = count(x -> is_observed(sys, x), sym)
num_observed = 0
for s in sym
num_observed += is_observed(sys, s)
num_observed > 1 && break # exit early, we only need to know whether 0, 1, or more
end
if !is_time_dependent(sys)
if num_observed == 0 || num_observed == 1 && sym isa Tuple
return MultipleGetters(nothing, getu.((sys,), sym))
Expand All @@ -275,7 +279,6 @@ for (t1, t2) in [
ts_idxs = collect(ts_idxs)
end

num_observed = count(x -> is_observed(sys, x), sym)
if num_observed == 0 || num_observed == 1 && sym isa Tuple
getters = getu.((sys,), sym)
return MultipleGetters(ts_idxs, getters)
Expand Down

0 comments on commit 5249fbb

Please sign in to comment.