Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions src/decompression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function in_triangle(i::Integer, j::Integer, uplo::Symbol)
return true
elseif uplo == :U
return i <= j
else
else # uplo == :L
return i >= j
end
end
Expand Down Expand Up @@ -434,35 +434,32 @@ function decompress_single_color!(
end

function decompress!(
A::SparseMatrixCSC{R}, B::AbstractMatrix{R}, result::StarSetColoringResult
) where {R<:Real}
@compat (; S, compressed_indices) = result
check_same_pattern(A, S)
nzA = nonzeros(A)
for k in eachindex(nzA, compressed_indices)
nzA[k] = B[compressed_indices[k]]
end
return A
end

function decompress!(
A::SparseMatrixCSC{R}, B::AbstractMatrix{R}, result::StarSetColoringResult, uplo::Symbol
A::SparseMatrixCSC{R},
B::AbstractMatrix{R},
result::StarSetColoringResult,
uplo::Symbol=:F,
) where {R<:Real}
@compat (; S, compressed_indices) = result
uplo == :F && check_same_pattern(A, S)
rvS = rowvals(S)
nzA = nonzeros(A)
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)
l += 1
nzA[l] = B[compressed_indices[k]]
if uplo == :F
check_same_pattern(A, S)
for k in eachindex(nzA, compressed_indices)
nzA[k] = B[compressed_indices[k]]
end
else
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)
l += 1
nzA[l] = B[compressed_indices[k]]
end
end
end
@assert l == length(nonzeros(A))
end
@assert l == length(nonzeros(A))
Comment thread
amontoison marked this conversation as resolved.
return A
end

Expand Down