Skip to content

Commit 96526a9

Browse files
ChrisRackauckasBenChung
authored andcommitted
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 73af465 commit 96526a9

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
@@ -889,7 +889,8 @@ end
889889
"""
890890
$(TYPEDSIGNATURES)
891891
892-
Mark a system as completed. If a system is complete, the system will no longer
892+
Mark a system as completed. A completed system is assumed to be a
893+
If a system is complete, the system will no longer
893894
namespace its subsystems or variables, i.e. `isequal(complete(sys).v.i, v.i)`.
894895
"""
895896
function complete(sys::AbstractSystem; split = true)
@@ -1872,17 +1873,16 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem)
18721873
end
18731874
end
18741875
limited && print(io, "\n")
1876+
return nothing
1877+
end
18751878

1879+
function Graphs.incidence_matrix(sys)
18761880
if has_torn_matching(sys) && has_tearing_state(sys)
1877-
# If the system can take a torn matching, then we can initialize a tearing
1878-
# state on it. Do so and get show the structure.
18791881
state = get_tearing_state(sys)
1880-
if state !== nothing
1881-
Base.printstyled(io, "\nIncidence matrix:"; color = :magenta)
1882-
show(io, mime, incidence_matrix(state.structure.graph, Num(Sym{Real}(:×))))
1883-
end
1882+
incidence_matrix(state.structure.graph, Num(Sym{Real}(:×)))
1883+
else
1884+
return nothing
18841885
end
1885-
return nothing
18861886
end
18871887

18881888
function split_assign(expr)

0 commit comments

Comments
 (0)