File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/structural_transformation Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -272,9 +272,14 @@ function build_observed_function(
272
272
required_algvars = Set (intersect (algvars, syms_set))
273
273
obs = observed (sys)
274
274
observed_idx = Dict (map (x-> x. lhs, obs) .=> 1 : length (obs))
275
- for sym in syms
276
- idx = get (observed_idx, sym, nothing )
275
+ # FIXME : this is a rather rough estimate of dependencies.
276
+ maxidx = 0
277
+ for (i, s) in enumerate (syms)
278
+ idx = get (observed_idx, s, nothing )
277
279
idx === nothing && continue
280
+ idx > maxidx && (maxidx = idx)
281
+ end
282
+ for idx in 1 : maxidx
278
283
vs = vars (obs[idx]. rhs)
279
284
union! (required_algvars, intersect (algvars, vs))
280
285
end
@@ -308,7 +313,10 @@ function build_observed_function(
308
313
],
309
314
[],
310
315
Let (
311
- collect (Iterators. flatten (solves)),
316
+ [
317
+ collect (Iterators. flatten (solves))
318
+ map (eq -> eq. lhs← eq. rhs, obs[1 : maxidx])
319
+ ],
312
320
isscalar ? output[1 ] : MakeArray (output, output_type)
313
321
)
314
322
) |> Code. toexpr
You can’t perform that action at this time.
0 commit comments