Skip to content

Commit e7b3808

Browse files
committed
Add test to check if node with single lincomb is trivial
1 parent 85f9ecb commit e7b3808

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/compress_graph.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ end
357357
"""
358358
compress_graph_passthrough!(graph,cref=[];verbose=false);
359359
360-
Identifies lincombs lincomb of length one with coeff equal to one. The node has no effect. It redirect appropriately.
360+
Identifies lincombs of length one with coeff equal to one.
361+
The node has no effect and is redirected appropriately.
361362
"""
362363

363364
function compress_graph_passthrough!(graph,

test/compress.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,15 @@ using LinearAlgebra
7070
@test has_trivial_nodes(graph) == true
7171

7272
graph = Compgraph()
73-
add_mult!(graph, :I2, :I, :I) # This node is trivial
74-
add_mult!(graph, :AI, :A, :I2) # This node is trivial
73+
add_lincomb!(graph, :A2, [2], [:A])
74+
add_output!(graph, :A2)
75+
@test has_trivial_nodes(graph) == false
76+
77+
graph = Compgraph()
78+
add_mult!(graph, :I2, :I, :I) # This node is trivial
79+
add_mult!(graph, :AI, :A, :I2) # This node is trivial
7580
add_mult!(graph, :IA, :I2, :AI) # This node is trivial
76-
add_ldiv!(graph, :P0, :I, :IA) # This node is trivial
81+
add_ldiv!(graph, :P0, :I, :IA) # This node is trivial
7782
add_output!(graph, :P0)
7883
graph1 = graph
7984
graph2 = deepcopy(graph)

0 commit comments

Comments
 (0)