Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #83 +/- ##
=======================================
Coverage 99.85% 99.86%
=======================================
Files 10 10
Lines 675 715 +40
=======================================
+ Hits 674 714 +40
Misses 1 1 ☔ View full report in Codecov by Sentry. |
|
@amontoison you asked why My reasoning is that between the following methods, the first one is more efficient (leads to predictable memory accesses) and should thus be preferred when 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
) where {R<:Real}
@compat (; S, compressed_indices) = result
check_same_pattern(A, S)
rvA = rowvals(A)
nzA = nonzeros(A)
for j in axes(S, 2)
for k in nzrange(S, j)
i = rvA[k]
if in_triangle(i, j, uplo)
nzA[k] = B[compressed_indices[k]]
end
end
end
return A
end |
|
You will not gain a lot if you do that: function decompress!(
A::SparseMatrixCSC{R}, B::AbstractMatrix{R}, result::StarSetColoringResult; uplo::Symbol=:F
) where {R<:Real}
@compat (; S, compressed_indices) = result
check_same_pattern(A, S)
nzA = nonzeros(A)
if uplo == :F
for k in eachindex(nzA, compressed_indices)
nzA[k] = B[compressed_indices[k]]
end
else
rvA = rowvals(A)
for j in axes(S, 2)
for k in nzrange(S, j)
i = rvA[k]
if in_triangle(i, j, uplo)
nzA[k] = B[compressed_indices[k]]
end
end
end
end
return A
end |
|
The issue is that sometimes |
True but with dispatch I avoid compiling the useless part of the code.
There was one spot where it was (erroneously) a kwarg, I fixed it in #85. I think now it should be a positional argument everywhere. |
|
You code too fast for me. It's perfect in that case. |
uplo = :U/:L/:ULparameter todecompress!anddecompress_single_color!to allow picking the triangle for symmetric matrices