Skip to content

Commit a2df751

Browse files
committed
Fix decompression.jl
1 parent 5a8b14c commit a2df751

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/decompression.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,6 @@ function decompress!(
562562
for (vertex, _) in reverse_bfs_orders[k]
563563
buffer_right_type[vertex] = zero(R)
564564
end
565-
566565
# Reset the buffer to zero for the root vertex
567566
(_, root) = reverse_bfs_orders[k][end]
568567
buffer_right_type[root] = zero(R)
@@ -643,13 +642,16 @@ function decompress!(
643642

644643
# Recover the off-diagonal coefficients of A
645644
for k in eachindex(reverse_bfs_orders)
646-
# Reset the buffer to zero for all vertices in a tree (except the root)
647-
for (vertex, _) in reverse_bfs_orders[k]
648-
buffer_right_type[vertex] = zero(R)
645+
# We need the buffer only when the tree is not a star (trivial or non-trivial)
646+
if !is_star[k]
647+
# Reset the buffer to zero for all vertices in a tree (except the root)
648+
for (vertex, _) in reverse_bfs_orders[k]
649+
buffer_right_type[vertex] = zero(R)
650+
end
651+
# Reset the buffer to zero for the root vertex
652+
(_, root) = reverse_bfs_orders[k][end]
653+
buffer_right_type[root] = zero(R)
649654
end
650-
# Reset the buffer to zero for the root vertex
651-
(_, root) = reverse_bfs_orders[k][end]
652-
buffer_right_type[root] = zero(R)
653655

654656
for (i, j) in reverse_bfs_orders[k]
655657
counter += 1

0 commit comments

Comments
 (0)