File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -575,7 +575,7 @@ function decompress!(
575575 nzA = nonzeros (A)
576576 uplo == :F && check_same_pattern (A, S)
577577
578- if eltype (buffer) == R
578+ if eltype (buffer) == R || isempty (buffer)
579579 buffer_right_type = buffer
580580 else
581581 buffer_right_type = similar (buffer, R)
Original file line number Diff line number Diff line change @@ -361,7 +361,8 @@ function TreeSetColoringResult(
361361
362362 # buffer holds the sum of edge values for subtrees in a tree.
363363 # For each vertex i, buffer[i] is the sum of edge values in the subtree rooted at i.
364- buffer = Vector {R} (undef, nvertices)
364+ # Note that we don't need a buffer is all trees are stars
365+ buffer = all (is_star) ? R[] : Vector {R} (undef, nvertices)
365366
366367 return TreeSetColoringResult (
367368 A,
Original file line number Diff line number Diff line change @@ -132,3 +132,16 @@ end;
132132 test_noallocs_structured_decompression (1000 ; structure, partition, decompression)
133133 end
134134end ;
135+
136+ @testset " Multi-precision acyclic decompression" begin
137+ A = sparse ([0 0 1 ; 0 1 0 ; 1 0 0 ])
138+ problem = ColoringProblem (; structure= :symmetric , partition= :column )
139+ result = coloring (A, problem, GreedyColoringAlgorithm {:substitution} ())
140+ @test isempty (result. buffer)
141+ for T in (Float32, Float64)
142+ C = rand (T) * T .(A)
143+ B = compress (C, result)
144+ bench_multiprecision = @be decompress! (C, B, result)
145+ @test minimum (bench_multiprecision). allocs == 0
146+ end
147+ end
You can’t perform that action at this time.
0 commit comments