Skip to content

Commit 1b5bf48

Browse files
authored
Update decompression_single_color! for star coloring
1 parent b33d436 commit 1b5bf48

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/decompression.jl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -455,30 +455,30 @@ function decompress_single_color!(
455455
result::StarSetColoringResult,
456456
uplo::Symbol=:F,
457457
)
458-
(; ag, color, group, star_set) = result
459-
(; hub, spokes) = star_set
458+
(; ag, compressed_indices, group) = result
460459
(; S) = ag
461460
uplo == :F && check_same_pattern(A, S)
462461

463-
# Recover the diagonal coefficients of A
464-
if has_diagonal(ag)
465-
for i in group[c]
466-
if !iszero(S[i, i])
467-
A[i, i] = b[i]
468-
end
469-
end
470-
end
471-
472-
# Recover the off-diagonal coefficients of A
473-
for s in eachindex(hub, spokes)
474-
j = abs(hub[s])
475-
if color[j] == c
476-
for i in spokes[s]
477-
if in_triangle(i, j, uplo)
478-
A[i, j] = b[i]
479-
end
480-
if in_triangle(j, i, uplo)
481-
A[j, i] = b[i]
462+
offset = (c - 1) * S.n
463+
lower_index = offset + 1
464+
upper_index = c * S.n
465+
rvS = rowvals(S)
466+
for j in group[c]
467+
for k in nzrange(S, j)
468+
if lower_index compressed_indices[k] upper_index
469+
l = compressed_indices[k] - offset
470+
i = rvS[k]
471+
if i == j
472+
# Recover the diagonal coefficients of A
473+
A[i, i] = b[l]
474+
else
475+
# Recover the off-diagonal coefficients of A
476+
if in_triangle(i, j, uplo)
477+
A[i, j] = b[l]
478+
end
479+
if in_triangle(j, i, uplo)
480+
A[j, i] = b[l]
481+
end
482482
end
483483
end
484484
end

0 commit comments

Comments
 (0)