Skip to content

Commit a5b64fb

Browse files
MasonProtterChrisRackauckas
authored andcommitted
cleaner
1 parent e62d814 commit a5b64fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/systems/systems.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ function __structural_simplify(sys::AbstractSystem, io = nothing; simplify = fal
130130
# Fix for https://github.com/SciML/ModelingToolkit.jl/issues/2490
131131
noise_eqs = if all(row -> count(!iszero, row) == 1, eachrow(sorted_g_rows)) # Does each row have only one non-zero entry?
132132
# then the noise is actually diagonal! make vector of non-zero entries.
133-
# This happens when the user uses N different `@brownian`s for `N` equations
134-
reduce(vcat, map(row -> filter(!iszero, row), eachrow(sorted_g_rows)))
133+
# This happens when the user uses multiple `@brownian`s but never mixes them
134+
map(eachrow(sorted_g_rows)) do row
135+
only(filter(!iszero, row))
136+
end
135137
elseif sorted_g_rows isa AbstractMatrix && size(sorted_g_rows, 2) == 1
136138
sorted_g_rows[:, 1] # Take a vector slice so solver knows there's no mixing
137139
else

0 commit comments

Comments
 (0)