Skip to content

Commit 0d1584e

Browse files
authored
Replace :UL with :F to select a triangle (#85)
* Replace `:UL` with `:F` to select a triangle * Fix typo * Update
1 parent 45dcc6b commit 0d1584e

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/decompression.jl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ end
124124
"""
125125
decompress!(
126126
A::AbstractMatrix, B::AbstractMatrix,
127-
result::AbstractColoringResult, [uplo=:UL]
127+
result::AbstractColoringResult, [uplo=:F]
128128
)
129129
130130
Decompress `B` in-place into `A`, given a coloring `result` of the sparsity pattern of `A`.
@@ -133,7 +133,7 @@ The out-of-place alternative is [`decompress`](@ref).
133133
Compression means summing either the columns or the rows of `A` which share the same color.
134134
It is done by calling [`compress`](@ref).
135135
136-
For `:symmetric` coloring results (and for those only), an optional positional argument `uplo in (:U, :L, :UL)` can be passed to specify which triangle of the matrix `A` should be updated: the upper one, the lower one, or both.
136+
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.
137137
138138
!!! note
139139
In-place decompression is faster when `A isa SparseMatrixCSC`.
@@ -188,7 +188,7 @@ function decompress! end
188188
"""
189189
decompress_single_color!(
190190
A::AbstractMatrix, b::AbstractVector, c::Integer,
191-
result::AbstractColoringResult, [uplo=:UL]
191+
result::AbstractColoringResult, [uplo=:F]
192192
)
193193
194194
Decompress the vector `b` corresponding to color `c` in-place into `A`, given a coloring `result` of the sparsity pattern of `A`.
@@ -197,7 +197,7 @@ Decompress the vector `b` corresponding to color `c` in-place into `A`, given a
197197
- If `result` comes from a `:nonsymmetric` structure with `:row` partition, this will update the rows of `A` that share color `c` (whose sum makes up `b`).
198198
- If `result` comes from a `:symmetric` structure with `:column` partition, this will update the coefficients of `A` whose value is deduced from color `c`.
199199
200-
For `:symmetric` coloring results (and for those only), an optional positional argument `uplo in (:U, :L, :UL)` can be passed to specify which triangle of the matrix `A` should be updated: the upper one, the lower one, or both.
200+
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.
201201
202202
!!! warning
203203
This function will only update some coefficients of `A`, without resetting the rest to zero.
@@ -251,7 +251,7 @@ true
251251
function decompress_single_color! end
252252

253253
function in_triangle(i::Integer, j::Integer, uplo::Symbol)
254-
if uplo == :UL
254+
if uplo == :F
255255
return true
256256
elseif uplo == :U
257257
return i <= j
@@ -374,7 +374,7 @@ function decompress!(
374374
A::AbstractMatrix{R},
375375
B::AbstractMatrix{R},
376376
result::StarSetColoringResult,
377-
uplo::Symbol=:UL,
377+
uplo::Symbol=:F,
378378
) where {R<:Real}
379379
@compat (; S, color, star_set) = result
380380
@compat (; star, hub, spokes) = star_set
@@ -405,7 +405,7 @@ function decompress_single_color!(
405405
b::AbstractVector{R},
406406
c::Integer,
407407
result::StarSetColoringResult,
408-
uplo::Symbol=:UL,
408+
uplo::Symbol=:F,
409409
) where {R<:Real}
410410
@compat (; S, color, group, star_set) = result
411411
@compat (; hub, spokes) = star_set
@@ -469,7 +469,7 @@ function decompress!(
469469
A::AbstractMatrix{R},
470470
B::AbstractMatrix{R},
471471
result::TreeSetColoringResult,
472-
uplo::Symbol=:UL,
472+
uplo::Symbol=:F,
473473
) where {R<:Real}
474474
@compat (; S, color, vertices_by_tree, reverse_bfs_orders, buffer) = result
475475
check_same_pattern(A, S)
@@ -511,7 +511,10 @@ end
511511
## MatrixInverseColoringResult
512512

513513
function decompress!(
514-
A::AbstractMatrix{R}, B::AbstractMatrix{R}, result::LinearSystemColoringResult; uplo=:UL
514+
A::AbstractMatrix{R},
515+
B::AbstractMatrix{R},
516+
result::LinearSystemColoringResult,
517+
uplo::Symbol=:F,
515518
) where {R<:Real}
516519
@compat (;
517520
S, color, strict_upper_nonzero_inds, T_factorization, strict_upper_nonzeros_A

test/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function test_coloring_decompression(
6060

6161
decompress!(A3upper, B, result, :U)
6262
decompress!(A3lower, B, result, :L)
63-
decompress!(A3both, B, result, :UL)
63+
decompress!(A3both, B, result, :F)
6464

6565
@test A3upper triu(A0)
6666
@test A3lower tril(A0)
@@ -80,7 +80,7 @@ function test_coloring_decompression(
8080
for c in unique(color)
8181
decompress_single_color!(A4upper, B[:, c], c, result, :U)
8282
decompress_single_color!(A4lower, B[:, c], c, result, :L)
83-
decompress_single_color!(A4both, B[:, c], c, result, :UL)
83+
decompress_single_color!(A4both, B[:, c], c, result, :F)
8484
end
8585

8686
@test A4upper triu(A0)

0 commit comments

Comments
 (0)