@@ -220,6 +220,7 @@ SII.all_symbols(nw::Network) = vcat(SII.all_variable_symbols(nw), SII.parameter_
220
220
# ###
221
221
# ### variable indexing
222
222
# ###
223
+ const POTENTIAL_SCALAR_SIDX = Union{SymbolicStateIndex{<: Union{Symbol,Int} ,<: Union{Int,Symbol} }}
223
224
function SII. is_variable (nw:: Network , sni)
224
225
if _hascolon (sni)
225
226
SII. is_variable (nw, _resolve_colon (nw,sni))
@@ -230,7 +231,7 @@ function SII.is_variable(nw::Network, sni)
230
231
end
231
232
end
232
233
_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 )
234
235
cf = getcomp (nw, sni)
235
236
return subsym_has_idx (sni. subidx, sym (cf))
236
237
end
@@ -244,7 +245,7 @@ function SII.variable_index(nw::Network, sni)
244
245
_variable_index (nw, sni)
245
246
end
246
247
end
247
- function _variable_index (nw:: Network , sni:: SymbolicStateIndex{<:Union{Symbol,Int},<:Union{Int,Symbol}} )
248
+ function _variable_index (nw:: Network , sni:: POTENTIAL_SCALAR_SIDX )
248
249
cf = getcomp (nw, sni)
249
250
range = getcomprange (nw, sni)
250
251
range[subsym_to_idx (sni. subidx, sym (cf))]
265
266
# ###
266
267
# ### parameter indexing
267
268
# ###
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
+ }
268
274
function SII. is_parameter (nw:: Network , sni)
269
275
if _hascolon (sni)
270
276
SII. is_parameter (nw, _resolve_colon (nw,sni))
@@ -275,8 +281,7 @@ function SII.is_parameter(nw::Network, sni)
275
281
end
276
282
end
277
283
_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 )
280
285
cf = getcomp (nw, sni)
281
286
return subsym_has_idx (sni. subidx, psym (cf))
282
287
end
@@ -290,15 +295,14 @@ function SII.parameter_index(nw::Network, sni)
290
295
_parameter_index (nw, sni)
291
296
end
292
297
end
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 )
295
299
cf = getcomp (nw, sni)
296
300
range = getcompprange (nw, sni)
297
301
range[subsym_to_idx (sni. subidx, psym (cf))]
298
302
end
299
303
300
304
function SII. parameter_symbols (nw:: Network )
301
- syms = Vector {SymbolicIndex {Int,Symbol}} (undef, pdim (nw))
305
+ syms = Vector {SymbolicParameterIndex {Int,Symbol}} (undef, pdim (nw))
302
306
for (ci, cf) in pairs (nw. im. vertexm)
303
307
syms[nw. im. v_para[ci]] .= VPIndex .(ci, psym (cf))
304
308
end
@@ -388,7 +392,7 @@ function SII.is_observed(nw::Network, sni)
388
392
end
389
393
end
390
394
_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} )
392
396
cf = getcomp (nw, sni)
393
397
return sni. subidx ∈ obssym_all (cf)
394
398
end
0 commit comments