Skip to content

Commit 6bc28a8

Browse files
fix: handle non-standard array indexes in parameter_index
1 parent 1e9d28f commit 6bc28a8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/ModelingToolkit.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ using RecursiveArrayTools
5656
import Graphs: SimpleDiGraph, add_edge!, incidence_matrix
5757
import BlockArrays: BlockArray, BlockedArray, Block, blocksize, blocksizes, blockpush!,
5858
undef_blocks, blocks
59+
using OffsetArrays: Origin
5960
import CommonSolve
6061
import EnumX
6162

src/systems/index_cache.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ function SymbolicIndexingInterface.parameter_index(ic::IndexCache, sym)
397397
pidx = parameter_index(ic, args[1])
398398
pidx === nothing && return nothing
399399
if pidx.portion == SciMLStructures.Tunable()
400-
ParameterIndex(pidx.portion, reshape(pidx.idx, size(args[1]))[args[2:end]...],
400+
ParameterIndex(pidx.portion,
401+
Origin(first.(axes((args[1]))))(reshape(pidx.idx, size(args[1])))[args[2:end]...],
401402
pidx.validate_size)
402403
else
403404
ParameterIndex(pidx.portion, (pidx.idx..., args[2:end]...), pidx.validate_size)

0 commit comments

Comments
 (0)