From 950a6a25786b48d67c8e082c700ff4f256a64ed4 Mon Sep 17 00:00:00 2001 From: Mason Protter Date: Sun, 21 Jul 2024 15:55:44 +0200 Subject: [PATCH] cleaner --- src/systems/systems.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/systems/systems.jl b/src/systems/systems.jl index 29b72954be..2600b8ea87 100644 --- a/src/systems/systems.jl +++ b/src/systems/systems.jl @@ -128,8 +128,10 @@ function __structural_simplify(sys::AbstractSystem, io = nothing; simplify = fal # Fix for https://github.com/SciML/ModelingToolkit.jl/issues/2490 noise_eqs = if all(row -> count(!iszero, row) == 1, eachrow(sorted_g_rows)) # Does each row have only one non-zero entry? # then the noise is actually diagonal! make vector of non-zero entries. - # This happens when the user uses N different `@brownian`s for `N` equations - reduce(vcat, map(row -> filter(!iszero, row), eachrow(sorted_g_rows))) + # This happens when the user uses multiple `@brownian`s but never mixes them + map(eachrow(sorted_g_rows)) do row + only(filter(!iszero, row)) + end elseif sorted_g_rows isa AbstractMatrix && size(sorted_g_rows, 2) == 1 sorted_g_rows[:, 1] # Take a vector slice so solver knows there's no mixing else