FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Accept AbstractSparseMatrixCSC for decompression by blegat · Pull Request #298 · JuliaDiff/SparseMatrixColorings.jl · GitHub

1 change: 1 addition & 0 deletions docs/src/dev.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ SparseMatrixColorings.TreeSetColoringResult
SparseMatrixColorings.LinearSystemColoringResult
SparseMatrixColorings.BicoloringResult
SparseMatrixColorings.remap_colors
SparseMatrixColorings.decompress_csc!
```

## Testing
Expand Down
34 changes: 28 additions & 6 deletions src/decompression.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,23 @@ function decompress!(
return A
end

function decompress!(
A::SparseMatrixCSC{R},
"""
decompress_csc!(
nzA::AbstractVector{R},
A_colptr::AbstractVector,
B::AbstractMatrix{R},
result::TreeSetColoringResult,
Comment thread
gdalle marked this conversation as resolved.
uplo::Symbol=:F,
) where {R<:Real}

Decompress the values of `B` into the vector of nonzero entries `nzA` of a
sparse matrix with column pointers `colptr`. This function assumes that the
row indices are sorted in increasing order and are the same as those of the
sparse matrix given to the `coloring` function that returned `result`.
"""
function decompress_csc!(
nzA::AbstractVector{R},
A_colptr::AbstractVector{<:Integer},
B::AbstractMatrix{R},
result::TreeSetColoringResult,
uplo::Symbol=:F,
Expand All @@ -603,10 +618,6 @@ function decompress!(
upper_triangle_offsets,
buffer,
) = result
(; S) = ag
A_colptr = A.colptr
nzA = nonzeros(A)
check_compatible_pattern(A, ag, uplo)

if eltype(buffer) == R
buffer_right_type = buffer
Expand Down Expand Up @@ -696,6 +707,17 @@ function decompress!(
#! format: on
end
end
return nothing
end

function decompress!(
A::SparseMatrixCSC{R},
B::AbstractMatrix{R},
result::TreeSetColoringResult,
uplo::Symbol=:F,
) where {R<:Real}
check_compatible_pattern(A, result.ag, uplo)
decompress_csc!(nonzeros(A), A.colptr, B, result, uplo)
return A
end

Expand Down
Loading

Back | FazBrowse Home | New Git URL