Skip to content

Commit 64ed5e4

Browse files
committed
Add finalize kwarg in pantelides
1 parent 3c8680c commit 64ed5e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/structural_transformation/pantelides.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ end
7575
Perform Pantelides algorithm.
7676
"""
7777
function pantelides!(state::TransformationState, ag::Union{AliasGraph, Nothing} = nothing;
78-
maxiters = 8000)
78+
finalize = true, maxiters = 8000)
7979
@unpack graph, solvable_graph, var_to_diff, eq_to_diff = state.structure
8080
neqs = nsrcs(graph)
8181
nvars = nv(var_to_diff)
@@ -164,7 +164,7 @@ function pantelides!(state::TransformationState, ag::Union{AliasGraph, Nothing}
164164
error("maxiters=$maxiters reached! File a bug report if your system has a reasonable index (<100), and you are using the default `maxiters`. Try to increase the maxiters by `pantelides(sys::ODESystem; maxiters=1_000_000)` if your system has an incredibly high index and it is truly extremely large.")
165165
end # for k in 1:neqs′
166166

167-
for var in 1:ndsts(graph)
167+
finalize && for var in 1:ndsts(graph)
168168
varwhitelist[var] && continue
169169
var_eq_matching[var] = unassigned
170170
end
@@ -180,6 +180,6 @@ instead, which calls this function internally.
180180
"""
181181
function dae_index_lowering(sys::ODESystem; kwargs...)
182182
state = TearingState(sys)
183-
var_eq_matching = pantelides!(state; kwargs...)
183+
var_eq_matching = pantelides!(state; finalize = false, kwargs...)
184184
return invalidate_cache!(pantelides_reassemble(state, var_eq_matching))
185185
end

0 commit comments

Comments
 (0)