Skip to content

Commit 99a0286

Browse files
fix: fix equality comparison of SDESystem
1 parent 1855dc2 commit 99a0286

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/systems/diffeqs/odesystem.jl

+10-1
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,22 @@ function populate_delays(delays::Set, obsexprs, histfn, sys, sym)
687687
end
688688

689689
function _eq_unordered(a, b)
690+
# a and b may be multidimensional
691+
# e.g. comparing noiseeqs of SDESystem
692+
a = vec(a)
693+
b = vec(b)
690694
length(a) === length(b) || return false
691695
n = length(a)
692696
idxs = Set(1:n)
693697
for x in a
694698
idx = findfirst(isequal(x), b)
699+
# loop since there might be multiple identical entries in a/b
700+
# and while we might have already matched the first there could
701+
# be a second that is equal to x
702+
while idx !== nothing && !(idx in idxs)
703+
idx = findnext(isequal(x), b, idx + 1)
704+
end
695705
idx === nothing && return false
696-
idx idxs || return false
697706
delete!(idxs, idx)
698707
end
699708
return true

0 commit comments

Comments
 (0)