Skip to content

Commit 7b6ce1e

Browse files
refactor: store array indices as isbits objects
1 parent 27e5394 commit 7b6ce1e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/systems/index_cache.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,18 @@ struct ParameterIndex{P, B, I}
1717
validate_size::Bool
1818
end
1919

20-
ParameterIndex(portion, idx, val = false) = ParameterIndex{typeof(portion), idx[1], typeof(idx)}(portion, idx, val)
21-
ParameterIndex(portion::Union{SciMLStructures.Tunable, SciMLStructures.Initials}, idx, val = false) = ParameterIndex{typeof(portion), idx, typeof(idx)}(portion, idx, val)
20+
function ParameterIndex(portion, idx, val = false)
21+
ParameterIndex{typeof(portion), idx[1], typeof(idx)}(portion, idx, val)
22+
end
23+
function ParameterIndex(portion::Union{SciMLStructures.Tunable, SciMLStructures.Initials},
24+
idx, val = false)
25+
ParameterIndex{typeof(portion), idx, typeof(idx)}(portion, idx, val)
26+
end
27+
function ParameterIndex(portion::Union{SciMLStructures.Tunable, SciMLStructures.Initials},
28+
idx::AbstractArray, val = false)
29+
idx = Origin(first.(axes(idx)))(SArray{Tuple{size(idx)...}}(idx))
30+
ParameterIndex{typeof(portion), idx, typeof(idx)}(portion, idx, val)
31+
end
2232
ParameterIndex(p::ParameterIndex) = ParameterIndex(p.portion, p.idx, false)
2333

2434
struct DiscreteIndex

0 commit comments

Comments
 (0)