Skip to content

Commit 90d301d

Browse files
committed
Fixes
1 parent da60d38 commit 90d301d

2 files changed

Lines changed: 19 additions & 28 deletions

File tree

src/check.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ function directly_recoverable_columns(
262262
end
263263

264264
"""
265-
valid_dynamic_order(g::AdjacencyGraph, π::AbstractVector{Int}, order::DynamicDegreeBasedOrder)
266-
valid_dynamic_order(bg::AdjacencyGraph, ::Val{side}, π::AbstractVector{Int}, order::DynamicDegreeBasedOrder)
265+
valid_dynamic_order(g::AdjacencyGraph, π::AbstractVector{<:Integer}, order::DynamicDegreeBasedOrder)
266+
valid_dynamic_order(bg::AdjacencyGraph, ::Val{side}, π::AbstractVector{<:Integer}, order::DynamicDegreeBasedOrder)
267267
268268
Check that a permutation `π` corresponds to a valid application of a [`DynamicDegreeBasedOrder`](@ref).
269269

src/result.jl

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ end
112112

113113
group_by_color(color::AbstractVector) = group_by_color(Int, color)
114114

115+
const AbstractGroups{T} = AbstractVector{<:AbstractVector{T}}
116+
115117
column_colors(result::AbstractColoringResult{s,:column}) where {s} = result.color
116118
column_groups(result::AbstractColoringResult{s,:column}) where {s} = result.group
117119

@@ -144,11 +146,7 @@ $TYPEDFIELDS
144146
- [`AbstractColoringResult`](@ref)
145147
"""
146148
struct ColumnColoringResult{
147-
M<:AbstractMatrix,
148-
T1<:Integer,
149-
T2<:Integer,
150-
G<:BipartiteGraph{T1},
151-
VVT1<:AbstractVector{<:AbstractVector{T1}},
149+
M<:AbstractMatrix,T1<:Integer,T2<:Integer,G<:BipartiteGraph{T1},GT1<:AbstractGroups{T1}
152150
} <: AbstractColoringResult{:nonsymmetric,:column,:direct}
153151
"matrix that was colored"
154152
A::M
@@ -157,7 +155,7 @@ struct ColumnColoringResult{
157155
"one integer color for each column or row (depending on `partition`)"
158156
color::Vector{T2}
159157
"color groups for columns or rows (depending on `partition`)"
160-
group::VVT1
158+
group::GT1
161159
"flattened indices mapping the compressed matrix `B` to the uncompressed matrix `A` when `A isa SparseMatrixCSC`. They satisfy `nonzeros(A)[k] = vec(B)[compressed_indices[k]]`"
162160
compressed_indices::Vector{T1}
163161
end
@@ -197,16 +195,12 @@ $TYPEDFIELDS
197195
- [`AbstractColoringResult`](@ref)
198196
"""
199197
struct RowColoringResult{
200-
M<:AbstractMatrix,
201-
T1<:Integer,
202-
T2<:Integer,
203-
G<:BipartiteGraph{T1},
204-
VVT1<:AbstractVector{<:AbstractVector{T1}},
198+
M<:AbstractMatrix,T1<:Integer,T2<:Integer,G<:BipartiteGraph{T1},GT1<:AbstractGroups{T1}
205199
} <: AbstractColoringResult{:nonsymmetric,:row,:direct}
206200
A::M
207201
bg::G
208202
color::Vector{T2}
209-
group::VVT1
203+
group::GT1
210204
compressed_indices::Vector{T1}
211205
end
212206

@@ -217,7 +211,7 @@ function RowColoringResult(
217211
group = group_by_color(T1, color)
218212
C = length(group) # ncolors
219213
rv = rowvals(S)
220-
compressed_indices = zeros(Int, nnz(S))
214+
compressed_indices = zeros(T1, nnz(S))
221215
for j in axes(S, 2)
222216
for k in nzrange(S, j)
223217
i = rv[k]
@@ -245,16 +239,12 @@ $TYPEDFIELDS
245239
- [`AbstractColoringResult`](@ref)
246240
"""
247241
struct StarSetColoringResult{
248-
M<:AbstractMatrix,
249-
T1<:Integer,
250-
T2<:Integer,
251-
G<:AdjacencyGraph{T1},
252-
VVT1<:AbstractVector{<:AbstractVector{T1}},
242+
M<:AbstractMatrix,T1<:Integer,T2<:Integer,G<:AdjacencyGraph{T1},GT1<:AbstractGroups{T1}
253243
} <: AbstractColoringResult{:symmetric,:column,:direct}
254244
A::M
255245
ag::G
256246
color::Vector{T2}
257-
group::VVT1
247+
group::GT1
258248
star_set::StarSet{T1}
259249
compressed_indices::Vector{T1}
260250
end
@@ -319,13 +309,13 @@ struct TreeSetColoringResult{
319309
T1<:Integer,
320310
T2<:Integer,
321311
G<:AdjacencyGraph{T1},
322-
VVT1<:AbstractVector{<:AbstractVector{T1}},
312+
GT1<:AbstractGroups{T1},
323313
R,
324314
} <: AbstractColoringResult{:symmetric,:column,:substitution}
325315
A::M
326316
ag::G
327317
color::Vector{T2}
328-
group::VVT1
318+
group::GT1
329319
reverse_bfs_orders::Vector{Vector{Tuple{T1,T1}}}
330320
diagonal_indices::Vector{T1}
331321
diagonal_nzind::Vector{T1}
@@ -447,14 +437,14 @@ struct LinearSystemColoringResult{
447437
T1<:Integer,
448438
T2<:Integer,
449439
G<:AdjacencyGraph{T1},
450-
VVT1<:AbstractVector{<:AbstractVector{T1}},
440+
GT1<:AbstractGroups{T1},
451441
R,
452442
F,
453443
} <: AbstractColoringResult{:symmetric,:column,:substitution}
454444
A::M
455445
ag::G
456446
color::Vector{T2}
457-
group::VVT1
447+
group::GT1
458448
strict_upper_nonzero_inds::Vector{Tuple{T1,T1}}
459449
strict_upper_nonzeros_A::Vector{R} # TODO: adjust type
460450
T_factorization::F # TODO: adjust type
@@ -483,6 +473,7 @@ function LinearSystemColoringResult(
483473
end
484474
end
485475

476+
# type annotated because JET was unhappy
486477
T::SparseMatrixCSC = spzeros(float(R), n * C, length(strict_upper_nonzero_inds))
487478
for (l, (i, j)) in enumerate(strict_upper_nonzero_inds)
488479
ci = color[i]
@@ -588,7 +579,7 @@ struct BicoloringResult{
588579
T2<:Integer,
589580
G<:AdjacencyGraph{T1},
590581
decompression,
591-
VVT1<:AbstractVector{<:AbstractVector{T1}},
582+
GT1<:AbstractGroups{T1},
592583
SR<:AbstractColoringResult{:symmetric,:column,decompression},
593584
R,
594585
} <: AbstractColoringResult{:nonsymmetric,:bidirectional,decompression}
@@ -601,9 +592,9 @@ struct BicoloringResult{
601592
"one integer color for each row"
602593
row_color::Vector{T2}
603594
"color groups for columns"
604-
column_group::VVT1
595+
column_group::GT1
605596
"color groups for rows"
606-
row_group::VVT1
597+
row_group::GT1
607598
"result for the coloring of the symmetric 2 x 2 block matrix"
608599
symmetric_result::SR
609600
"maps symmetric colors to column colors"

0 commit comments

Comments
 (0)