Skip to content

Commit cf67f77

Browse files
fix: fix _eq_unordered for multiple identical values in both a and b
1 parent 2844170 commit cf67f77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/systems/diffeqs/odesystem.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,17 @@ function populate_delays(delays::Set, obsexprs, histfn, sys, sym)
687687
end
688688

689689
function _eq_unordered(a, b)
690+
a = vec(a)
691+
b = vec(b)
690692
length(a) === length(b) || return false
691693
n = length(a)
692694
idxs = Set(1:n)
693695
for x in a
694696
idx = findfirst(isequal(x), b)
697+
while idx !== nothing && !(idx in idxs)
698+
idx = findnext(isequal(x), b, idx + 1)
699+
end
695700
idx === nothing && return false
696-
idx idxs || return false
697701
delete!(idxs, idx)
698702
end
699703
return true

0 commit comments

Comments
 (0)