diff --git a/src/parameter_indexing.jl b/src/parameter_indexing.jl index d7b73cf..5f9ed12 100644 --- a/src/parameter_indexing.jl +++ b/src/parameter_indexing.jl @@ -161,7 +161,6 @@ function _getp(sys, ::ScalarSymbolic, ::SymbolicTypeTrait, p) idx = parameter_index(sys, p) return invoke(_getp, Tuple{Any, NotSymbolic, NotSymbolic, Any}, sys, NotSymbolic(), NotSymbolic(), idx) - return _getp(sys, NotSymbolic(), NotSymbolic(), idx) end for (t1, t2) in [ @@ -229,6 +228,11 @@ for (t1, t2) in [ end function _getp(sys, ::ArraySymbolic, ::NotSymbolic, p) + if is_parameter(sys, p) + idx = parameter_index(sys, p) + return invoke(_getp, Tuple{Any, NotSymbolic, NotSymbolic, Any}, + sys, NotSymbolic(), NotSymbolic(), idx) + end return getp(sys, collect(p)) end @@ -294,5 +298,9 @@ for (t1, t2) in [ end function _setp(sys, ::ArraySymbolic, ::NotSymbolic, p) + if is_parameter(sys, p) + idx = parameter_index(sys, p) + return setp(sys, idx; run_hook = false) + end return setp(sys, collect(p); run_hook = false) end diff --git a/src/state_indexing.jl b/src/state_indexing.jl index 782fc7b..0229f42 100644 --- a/src/state_indexing.jl +++ b/src/state_indexing.jl @@ -239,6 +239,12 @@ for (t1, t2) in [ end function _getu(sys, ::ArraySymbolic, ::NotSymbolic, sym) + if is_variable(sys, sym) + idx = variable_index(sys, sym) + return getu(sys, idx) + elseif is_parameter(sys, sym) + return getp(sys, sym) + end return getu(sys, collect(sym)) end @@ -295,5 +301,11 @@ for (t1, t2) in [ end function _setu(sys, ::ArraySymbolic, ::NotSymbolic, sym) + if is_variable(sys, sym) + idx = variable_index(sys, sym) + return setu(sys, idx) + elseif is_parameter(sys, sym) + return setp(sys, sym) + end return setu(sys, collect(sym)) end