You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- `partition::Symbol`: either `:row` or `:column`.
16
25
- `matrix_template::AbstractMatrix`: matrix for which the vector of colors was precomputed (the algorithm will only accept matrices of the exact same size).
17
26
- `color::Vector{<:Integer}`: vector of integer colors, one for each row or column (depending on `partition`).
27
+
- `allow_denser::Bool`: whether or not to allow decompression into a `SparseMatrixCSC` which has more nonzeros than the original sparsity pattern (see [`decompress!`](@ref) to know when this is implemented).
18
28
19
29
!!! warning
20
30
The second constructor (based on keyword arguments) is type-unstable.
Copy file name to clipboardExpand all lines: src/decompression.jl
+58-15Lines changed: 58 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -189,15 +189,25 @@ The out-of-place alternative is [`decompress`](@ref).
189
189
190
190
!!! note
191
191
In-place decompression is faster when `A isa SparseMatrixCSC`.
192
-
- In general, this case requires the sparsity pattern of `A` to match the sparsity pattern `S` from which the coloring result was computed.
193
-
- For a coloring result with `decompression=:direct`, we also allow _full_ decompression into an `A` whose sparsity pattern is a strict superset of `S`.
194
192
195
193
Compression means summing either the columns or the rows of `A` which share the same color.
196
194
It is done by calling [`compress`](@ref).
197
195
196
+
# Details
197
+
198
198
For `:symmetric` coloring results (and for those only), an optional positional argument `uplo in (:U, :L, :F)` can be passed to specify which part of the matrix `A` should be updated: the Upper triangle, the Lower triangle, or the Full matrix.
199
199
When `A isa SparseMatrixCSC`, using the `uplo` argument requires a target matrix which only stores the relevant triangle(s).
200
200
201
+
Some coloring algorithms ([`GreedyColoringAlgorithm`](@ref) and [`ConstantColoringAlgorithm`](@ref)) have an option called `allow_denser`, which enables in-place decompression into a `SparseMatrixCSC` containing more structural nonzeros than the sparsity pattern used for coloring.
202
+
203
+
!!! warning
204
+
Decompression into a denser `SparseMatrixCSC` is only implemented when all the conditions below are satisfied simultaneously:
205
+
- the partition is `:row` or `:column` (not `:bidirectional`)
206
+
- the decompression is `:direct` (not `:substitution`)
207
+
- the decompression is full (so [`decompress_single_color!`](@ref) will not work)
208
+
209
+
Outside of these cases, it is up to the user to make sure that the sparsity pattern of the decompression target is an exact match.
210
+
201
211
# Example
202
212
203
213
```jldoctest
@@ -212,6 +222,8 @@ julia> A = sparse([
212
222
213
223
julia> result = coloring(A, ColoringProblem(), GreedyColoringAlgorithm());
4×6 SparseMatrixCSC{Int64, Int64} with 11 stored entries:
256
+
0 ⋅ 4 6 ⋅ 9
257
+
1 ⋅ ⋅ ⋅ 7 ⋅
258
+
⋅ 2 ⋅ ⋅ 8 ⋅
259
+
⋅ 3 5 ⋅ ⋅ 0
260
+
261
+
julia> A3 == A
262
+
true
239
263
```
240
264
241
265
# See also
@@ -260,6 +284,8 @@ Decompress the vector `b` corresponding to color `c` in-place into `A`, given a
260
284
!!! warning
261
285
This function will only update some coefficients of `A`, without resetting the rest to zero.
262
286
287
+
# Details
288
+
263
289
For `:symmetric` coloring results (and for those only), an optional positional argument `uplo in (:U, :L, :F)` can be passed to specify which part of the matrix `A` should be updated: the Upper triangle, the Lower triangle, or the Full matrix.
264
290
When `A isa SparseMatrixCSC`, using the `uplo` argument requires a target matrix which only stores the relevant triangle(s).
265
291
@@ -356,27 +382,28 @@ function decompress_single_color!(
0 commit comments