@@ -220,6 +220,7 @@ SII.all_symbols(nw::Network) = vcat(SII.all_variable_symbols(nw), SII.parameter_
220220# ###
221221# ### variable indexing
222222# ###
223+ const POTENTIAL_SCALAR_SIDX = Union{SymbolicStateIndex{<: Union{Symbol,Int} ,<: Union{Int,Symbol} }}
223224function SII. is_variable (nw:: Network , sni)
224225 if _hascolon (sni)
225226 SII. is_variable (nw, _resolve_colon (nw,sni))
@@ -230,7 +231,7 @@ function SII.is_variable(nw::Network, sni)
230231 end
231232end
232233_is_variable (nw:: Network , sni) = false
233- function _is_variable (nw:: Network , sni:: SymbolicStateIndex{<:Union{Symbol,Int},<:Union{Int,Symbol}} )
234+ function _is_variable (nw:: Network , sni:: POTENTIAL_SCALAR_SIDX )
234235 cf = getcomp (nw, sni)
235236 return subsym_has_idx (sni. subidx, sym (cf))
236237end
@@ -244,7 +245,7 @@ function SII.variable_index(nw::Network, sni)
244245 _variable_index (nw, sni)
245246 end
246247end
247- function _variable_index (nw:: Network , sni:: SymbolicStateIndex{<:Union{Symbol,Int},<:Union{Int,Symbol}} )
248+ function _variable_index (nw:: Network , sni:: POTENTIAL_SCALAR_SIDX )
248249 cf = getcomp (nw, sni)
249250 range = getcomprange (nw, sni)
250251 range[subsym_to_idx (sni. subidx, sym (cf))]
265266# ###
266267# ### parameter indexing
267268# ###
269+ # when using an number instead of symbol only PIndex is valid
270+ const POTENTIAL_SCALAR_PIDX = Union{
271+ SymbolicParameterIndex{<: Union{Symbol,Int} ,<: Union{Int,Symbol} },
272+ SymbolicIndex{<: Union{Symbol,Int} ,Symbol}
273+ }
268274function SII. is_parameter (nw:: Network , sni)
269275 if _hascolon (sni)
270276 SII. is_parameter (nw, _resolve_colon (nw,sni))
@@ -275,8 +281,7 @@ function SII.is_parameter(nw::Network, sni)
275281 end
276282end
277283_is_parameter (nw:: Network , sni) = false
278- function _is_parameter (nw:: Network ,
279- sni:: SymbolicIndex{<:Union{Symbol,Int},<:Union{Int,Symbol}} )
284+ function _is_parameter (nw:: Network , sni:: POTENTIAL_SCALAR_PIDX )
280285 cf = getcomp (nw, sni)
281286 return subsym_has_idx (sni. subidx, psym (cf))
282287end
@@ -290,15 +295,14 @@ function SII.parameter_index(nw::Network, sni)
290295 _parameter_index (nw, sni)
291296 end
292297end
293- function _parameter_index (nw:: Network ,
294- sni:: SymbolicIndex{<:Union{Symbol,Int},<:Union{Int,Symbol}} )
298+ function _parameter_index (nw:: Network , sni:: POTENTIAL_SCALAR_PIDX )
295299 cf = getcomp (nw, sni)
296300 range = getcompprange (nw, sni)
297301 range[subsym_to_idx (sni. subidx, psym (cf))]
298302end
299303
300304function SII. parameter_symbols (nw:: Network )
301- syms = Vector {SymbolicIndex {Int,Symbol}} (undef, pdim (nw))
305+ syms = Vector {SymbolicParameterIndex {Int,Symbol}} (undef, pdim (nw))
302306 for (ci, cf) in pairs (nw. im. vertexm)
303307 syms[nw. im. v_para[ci]] .= VPIndex .(ci, psym (cf))
304308 end
@@ -388,7 +392,7 @@ function SII.is_observed(nw::Network, sni)
388392 end
389393end
390394_is_observed (nw:: Network , _) = false
391- function _is_observed (nw:: Network , sni:: SymbolicStateIndex{<:Union{Symbol,Int},<:Union{Int, Symbol} } )
395+ function _is_observed (nw:: Network , sni:: SymbolicStateIndex{<:Union{Symbol,Int},Symbol} )
392396 cf = getcomp (nw, sni)
393397 return sni. subidx ∈ obssym_all (cf)
394398end
0 commit comments