Skip to content

Commit d2dba79

Browse files
committed
add check to avoid accidental singulatity error after structural_simplify
1 parent ea846ab commit d2dba79

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/systems/diffeqs/abstractodesystem.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ function process_DEProblem(constructor, sys::AbstractODESystem,u0map,parammap;
304304
p = ps
305305
end
306306

307+
@assert length(dvs) == length(u0) "states and initial conditions are of different lengths"
308+
307309
f = constructor(sys,dvs,ps,u0;tgrad=tgrad,jac=jac,checkbounds=checkbounds,
308310
linenumbers=linenumbers,parallel=parallel,simplify=simplify,
309311
sparse=sparse,eval_expression=eval_expression,kwargs...)

src/systems/nonlinear/nonlinearsystem.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ function process_NonlinearProblem(constructor, sys::NonlinearSystem,u0map,paramm
223223
p = ps
224224
end
225225

226+
@assert length(dvs) == length(u0) "states and initial conditions are of different lengths"
227+
226228
f = constructor(sys,dvs,ps,u0;jac=jac,checkbounds=checkbounds,
227229
linenumbers=linenumbers,parallel=parallel,simplify=simplify,
228230
sparse=sparse,eval_expression=eval_expression,kwargs...)

0 commit comments

Comments
 (0)