Skip to content

Commit 089e45b

Browse files
committed
Fix decompression.jl
1 parent 8a90816 commit 089e45b

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
@@ -546,7 +546,6 @@ function decompress!(
546546
for (vertex, _) in reverse_bfs_orders[k]
547547
buffer_right_type[vertex] = zero(R)
548548
end
549-
550549
# Reset the buffer to zero for the root vertex
551550
(_, root) = reverse_bfs_orders[k][end]
552551
buffer_right_type[root] = zero(R)
@@ -627,13 +626,16 @@ function decompress!(
627626

628627
# Recover the off-diagonal coefficients of A
629628
for k in eachindex(reverse_bfs_orders)
630-
# Reset the buffer to zero for all vertices in a tree (except the root)
631-
for (vertex, _) in reverse_bfs_orders[k]
632-
buffer_right_type[vertex] = zero(R)
629+
# We need the buffer only when the tree is not a star (trivial or non-trivial)
630+
if !is_star[k]
631+
# Reset the buffer to zero for all vertices in a tree (except the root)
632+
for (vertex, _) in reverse_bfs_orders[k]
633+
buffer_right_type[vertex] = zero(R)
634+
end
635+
# Reset the buffer to zero for the root vertex
636+
(_, root) = reverse_bfs_orders[k][end]
637+
buffer_right_type[root] = zero(R)
633638
end
634-
# Reset the buffer to zero for the root vertex
635-
(_, root) = reverse_bfs_orders[k][end]
636-
buffer_right_type[root] = zero(R)
637639

638640
for (i, j) in reverse_bfs_orders[k]
639641
counter += 1

0 commit comments

Comments
 (0)