From de23fc7f9c6d1214731ad3c5c80b4d157c5b1c2e Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Tue, 25 Mar 2025 02:33:27 -0500 Subject: [PATCH 1/2] Improve the decompression of star coloring for AbstractMatrix --- src/decompression.jl | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/decompression.jl b/src/decompression.jl index a1989a0c..2b14c181 100644 --- a/src/decompression.jl +++ b/src/decompression.jl @@ -431,31 +431,21 @@ end function decompress!( A::AbstractMatrix, B::AbstractMatrix, result::StarSetColoringResult, uplo::Symbol=:F ) - (; ag, color, star_set) = result - (; star, hub, spokes) = star_set + (; ag, compressed_indices) = result (; S) = ag uplo == :F && check_same_pattern(A, S) fill!(A, zero(eltype(A))) - # Recover the diagonal coefficients of A - if has_diagonal(ag) - for i in axes(A, 1) - if !iszero(S[i, i]) - A[i, i] = B[i, color[i]] - end - end - end - - # Recover the off-diagonal coefficients of A - for s in eachindex(hub, spokes) - j = abs(hub[s]) - cj = color[j] - for i in spokes[s] + rvS = rowvals(S) + l = 0 # assume A has the same pattern as the triangle + for j in axes(S, 2) + for k in nzrange(S, j) + i = rvS[k] if in_triangle(i, j, uplo) - A[i, j] = B[i, cj] + A[i, j] = B[compressed_indices[k]] end if in_triangle(j, i, uplo) - A[j, i] = B[i, cj] + A[j, i] = B[compressed_indices[k]] end end end @@ -523,7 +513,6 @@ function decompress!( end end end - @assert l == length(nonzeros(A)) end return A end From bb4b579a45f5d0c65ff8e0f591c1277eaf4db6dc Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Tue, 25 Mar 2025 02:37:37 -0500 Subject: [PATCH 2/2] Fix decompression.jl --- src/decompression.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/decompression.jl b/src/decompression.jl index 2b14c181..1a8f9a2d 100644 --- a/src/decompression.jl +++ b/src/decompression.jl @@ -437,16 +437,12 @@ function decompress!( fill!(A, zero(eltype(A))) rvS = rowvals(S) - l = 0 # assume A has the same pattern as the triangle for j in axes(S, 2) for k in nzrange(S, j) i = rvS[k] if in_triangle(i, j, uplo) A[i, j] = B[compressed_indices[k]] end - if in_triangle(j, i, uplo) - A[j, i] = B[compressed_indices[k]] - end end end return A