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
Copy file name to clipboardExpand all lines: src/decompression.jl
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -711,9 +711,9 @@ function _join_compressed!(result::BicoloringResult, Br::AbstractMatrix, Bc::Abs
711
711
Therefore, the column indices in `Br_and_Bc` don't necessarily match with the row indices in `Br` or the column indices in `Bc` since some colors may be missing in the partial compressions.
712
712
The columns of the top part of `Br_and_Bc` (rows `1:n`) are the rows of `Br`, interlaced with zero columns whenever the current color hasn't been used to color any row.
713
713
The columns of the bottom part of `Br_and_Bc` (rows `n+1:n+m`) are the columns of `Bc`, interlaced with zero columns whenever the current color hasn't been used to color any column.
714
-
We use the dictionaries `col_color_ind` and `row_color_ind` to map from symmetric colors to row/column colors.
714
+
We use the vectors `symmetric_to_row` and `symmetric_to_column` to map from symmetric colors to row and column colors.
715
715
=#
716
-
(; A, col_color_ind, row_color_ind) = result
716
+
(; A, symmetric_to_column, symmetric_to_row) = result
717
717
m, n =size(A)
718
718
R = Base.promote_eltype(Br, Bc)
719
719
ifeltype(result.Br_and_Bc) == R
@@ -723,11 +723,13 @@ function _join_compressed!(result::BicoloringResult, Br::AbstractMatrix, Bc::Abs
723
723
end
724
724
fill!(Br_and_Bc, zero(R))
725
725
for c inaxes(Br_and_Bc, 2)
726
-
ifhaskey(row_color_ind, c) # some rows were colored with symmetric color c
Renumber the colors in `color` using their index in the vector `sort(unique(color))`, so that the non-zero colors are forced to go from `1` to some `cmax` contiguously.
461
+
Return a tuple `(row_color, column_color, symmetric_to_row, symmetric_to_column)` such that `row_color` and `column_color` are vectors containing the renumbered colors for rows and columns.
462
+
`symmetric_to_row` and `symmetric_to_column` are vectors that map symmetric colors to row and column colors.
462
463
463
-
Return a tuple `(remapped_colors, color_to_ind)` such that `remapped_colors` is a vector containing the renumbered colors and `color_to_ind` is a dictionary giving the translation between old and new color numberings.
464
+
For all vertex indices `i` between `1` and `m` we have:
464
465
465
-
For all vertex indices `i` we have:
466
+
row_color[i] = symmetric_to_row[color[n+i]]
466
467
467
-
remapped_color[i] = color_to_ind[color[i]]
468
+
For all vertex indices `j` between `1` and `n` we have:
469
+
470
+
column_color[j] = symmetric_to_column[color[j]]
468
471
"""
469
-
functionremap_colors(color::Vector{Int})
470
-
sorted_colors =sort!(unique(color))
471
-
offset = sorted_colors[1] ==0?1:0
472
-
color_to_ind =Dict(c => i - offset for (i, c) inenumerate(sorted_colors))
473
-
remapped_colors = [color_to_ind[c] for c in color]
0 commit comments