Skip to content

Commit dad0013

Browse files
Remove incidence matrix from system show
Fixes #2178 > The incidence matrix is actually not useful for humans. I am just showing it because it looks cool. We can just disable it if it's confusing. I'm not even sure it's worth documenting, but who it's useful for is for the compiler writers since if structural simplification works, then you're good. Maybe it's useful for diagnosing singularities, but that should get a debugging page because someone would need to get introduced to what it is for it to be useful. So I keep it around as a `ModelingToolkit.incidence_matrix` function that can be easily queried, but it's removed from the default show.
1 parent 2b90f68 commit dad0013

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/systems/abstractsystem.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,8 @@ end
876876
"""
877877
$(TYPEDSIGNATURES)
878878
879-
Mark a system as completed. If a system is complete, the system will no longer
879+
Mark a system as completed. A completed system is assumed to be a
880+
If a system is complete, the system will no longer
880881
namespace its subsystems or variables, i.e. `isequal(complete(sys).v.i, v.i)`.
881882
"""
882883
function complete(sys::AbstractSystem; split = true)
@@ -1859,17 +1860,16 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem)
18591860
end
18601861
end
18611862
limited && print(io, "\n")
1863+
return nothing
1864+
end
18621865

1866+
function Graphs.incidence_matrix(sys)
18631867
if has_torn_matching(sys) && has_tearing_state(sys)
1864-
# If the system can take a torn matching, then we can initialize a tearing
1865-
# state on it. Do so and get show the structure.
18661868
state = get_tearing_state(sys)
1867-
if state !== nothing
1868-
Base.printstyled(io, "\nIncidence matrix:"; color = :magenta)
1869-
show(io, mime, incidence_matrix(state.structure.graph, Num(Sym{Real}(:×))))
1870-
end
1869+
incidence_matrix(state.structure.graph, Num(Sym{Real}(:×)))
1870+
else
1871+
return nothing
18711872
end
1872-
return nothing
18731873
end
18741874

18751875
function split_assign(expr)

0 commit comments

Comments
 (0)