You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/basics/FAQ.md
+59Lines changed: 59 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -244,3 +244,62 @@ D = Differential(x)
244
244
@variablesy(x)
245
245
@named sys =ODESystem([D(y) ~ x], x)
246
246
```
247
+
248
+
## Ordering of tunable parameters
249
+
250
+
Tunable parameters are floating point parameters, not used in callbacks and not marked with `tunable = false` in their metadata. These are expected to be used with AD
251
+
and optimization libraries. As such, they are stored together in one `Vector{T}`. To obtain the ordering of tunable parameters in this buffer, use:
252
+
253
+
```@docs
254
+
tunable_parameters
255
+
```
256
+
257
+
If you have an array in which a particular dimension is in the order of tunable parameters (e.g. the jacobian with respect to tunables) then that dimension of the
258
+
array can be reordered into the required permutation using the symbolic variables:
259
+
260
+
```@docs
261
+
reorder_dimension_by_tunables!
262
+
reorder_dimension_by_tunables
263
+
```
264
+
265
+
For example:
266
+
267
+
```@example reorder
268
+
using ModelingToolkit
269
+
270
+
@parameters p q[1:3] r[1:2, 1:2]
271
+
272
+
@named sys = ODESystem(Equation[], ModelingToolkit.t_nounits, [], [p, q, r])
273
+
sys = complete(sys)
274
+
```
275
+
276
+
The canonicalized tunables portion of `MTKParameters` will be in the order of tunables:
0 commit comments