@@ -431,31 +431,21 @@ end
431431function decompress! (
432432 A:: AbstractMatrix , B:: AbstractMatrix , result:: StarSetColoringResult , uplo:: Symbol = :F
433433)
434- (; ag, color, star_set) = result
435- (; star, hub, spokes) = star_set
434+ (; ag, compressed_indices) = result
436435 (; S) = ag
437436 uplo == :F && check_same_pattern (A, S)
438437 fill! (A, zero (eltype (A)))
439438
440- # Recover the diagonal coefficients of A
441- if has_diagonal (ag)
442- for i in axes (A, 1 )
443- if ! iszero (S[i, i])
444- A[i, i] = B[i, color[i]]
445- end
446- end
447- end
448-
449- # Recover the off-diagonal coefficients of A
450- for s in eachindex (hub, spokes)
451- j = abs (hub[s])
452- cj = color[j]
453- for i in spokes[s]
439+ rvS = rowvals (S)
440+ l = 0 # assume A has the same pattern as the triangle
441+ for j in axes (S, 2 )
442+ for k in nzrange (S, j)
443+ i = rvS[k]
454444 if in_triangle (i, j, uplo)
455- A[i, j] = B[i, cj ]
445+ A[i, j] = B[compressed_indices[k] ]
456446 end
457447 if in_triangle (j, i, uplo)
458- A[j, i] = B[i, cj ]
448+ A[j, i] = B[compressed_indices[k] ]
459449 end
460450 end
461451 end
@@ -523,7 +513,6 @@ function decompress!(
523513 end
524514 end
525515 end
526- @assert l == length (nonzeros (A))
527516 end
528517 return A
529518end
0 commit comments