Skip to content

Commit 5cf19a9

Browse files
committed
NonlinearSystem: put single equation input in vector, instead of scalarizing
1 parent b669cc9 commit 5cf19a9

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/systems/nonlinear/nonlinearsystem.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,13 @@ function NonlinearSystem(eqs, unknowns, ps;
126126
throw(ArgumentError("NonlinearSystem does not accept `continuous_events`, you provided $continuous_events"))
127127
discrete_events === nothing || isempty(discrete_events) ||
128128
throw(ArgumentError("NonlinearSystem does not accept `discrete_events`, you provided $discrete_events"))
129-
130129
name === nothing &&
131130
throw(ArgumentError("The `name` keyword must be provided. Please consider using the `@named` macro"))
132-
# Move things over, but do not touch array expressions
133-
#
134-
# # we cannot scalarize in the loop because `eqs` itself might require
135-
# scalarization
136-
eqs = [x.lhs isa Union{Symbolic, Number} ? 0 ~ x.rhs - x.lhs : x
137-
for x in scalarize(eqs)]
131+
132+
# Accept a single (scalar/vector) equation, but make array for consistent internal handling
133+
if !(eqs isa AbstractArray)
134+
eqs = [eqs]
135+
end
138136

139137
if !(isempty(default_u0) && isempty(default_p))
140138
Base.depwarn(

0 commit comments

Comments
 (0)