@@ -182,6 +182,24 @@ function SymbolicIndexingInterface.set_parameter!(p::MTKParameters, val, idx::Pa
182
182
end
183
183
end
184
184
185
+ function _set_parameter_unchecked! (p:: MTKParameters , val, idx:: ParameterIndex )
186
+ @unpack portion, idx = idx
187
+ update_dependent = true
188
+ if portion isa SciMLStructures. Tunable
189
+ p. tunable[idx] = val
190
+ elseif portion isa SciMLStructures. Discrete
191
+ p. discrete[idx] = val
192
+ elseif portion isa SciMLStructures. Constants
193
+ p. constant[idx] = val
194
+ elseif portion === nothing
195
+ p. dependent[idx] = val
196
+ update_dependent = false
197
+ else
198
+ error (" Unhandled portion $portion " )
199
+ end
200
+ update_dependent && p. dependent_update_iip != = nothing && p. dependent_update_iip (p. dependent, p... )
201
+ end
202
+
185
203
_subarrays (v:: AbstractVector ) = isempty (v) ? () : (v,)
186
204
_subarrays (v:: ArrayPartition ) = v. x
187
205
_num_subarrays (v:: AbstractVector ) = 1
@@ -249,7 +267,7 @@ function jacobian_wrt_vars(pf::F, p::MTKParameters, input_idxs, chunk::C) where
249
267
250
268
function (p_small_inner)
251
269
for (i, val) in zip (input_idxs, p_small_inner)
252
- set_parameter ! (p_big, val, i)
270
+ _set_parameter_unchecked ! (p_big, val, i)
253
271
end
254
272
# tunable, repack, _ = SciMLStructures.canonicalize(SciMLStructures.Tunable(), p_big)
255
273
# tunable[input_idxs] .= p_small_inner
0 commit comments