File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -250,7 +250,14 @@ function build_explicit_observed_function(
250
250
251
251
obs = observed (sys)
252
252
observed_idx = Dict (map (x-> x. lhs, obs) .=> 1 : length (obs))
253
- output = map (sym-> obs[observed_idx[sym]]. rhs, syms)
253
+ output = similar (syms, Any)
254
+ # FIXME : this is a rather rough estimate of dependencies.
255
+ maxidx = 0
256
+ for (i, s) in enumerate (syms)
257
+ idx = observed_idx[s]
258
+ idx > maxidx && (maxidx = idx)
259
+ output[i] = obs[idx]. rhs
260
+ end
254
261
255
262
ex = Func (
256
263
[
@@ -259,7 +266,10 @@ function build_explicit_observed_function(
259
266
independent_variable (sys)
260
267
],
261
268
[],
262
- isscalar ? output[1 ] : MakeArray (output, output_type)
269
+ Let (
270
+ map (eq -> eq. lhs← eq. rhs, obs[1 : maxidx]),
271
+ isscalar ? output[1 ] : MakeArray (output, output_type)
272
+ )
263
273
) |> toexpr
264
274
265
275
expression ? ex : @RuntimeGeneratedFunction (ex)
You can’t perform that action at this time.
0 commit comments