@@ -581,14 +581,20 @@ $TYPEDFIELDS
581581
582582- [`AbstractColoringResult`](@ref)
583583"""
584- struct StarSetBicoloringResult{M<: AbstractMatrix ,G<: AdjacencyGraph ,V} < :
585- AbstractColoringResult{:nonsymmetric ,:bidirectional ,:direct }
584+ struct StarSetBicoloringResult{
585+ M<: AbstractMatrix ,
586+ T<: Integer ,
587+ G<: AdjacencyGraph{T} ,
588+ GT<: AbstractGroups{T} ,
589+ SR<: AbstractColoringResult{:symmetric,:column,:direct} ,
590+ R,
591+ } <: AbstractColoringResult{:nonsymmetric,:bidirectional,:direct}
586592 " matrix that was colored"
587593 A:: M
588594 " augmented adjacency graph that was used for bicoloring"
589- ag :: G
595+ abg :: G
590596 " one integer color for each axis of the augmented matrix"
591- symmetric_color :: Vector{Int }
597+ color :: Vector{T }
592598 " one integer color for each column"
593599 column_color:: Vector{T}
594600 " one integer color for each row"
@@ -618,12 +624,15 @@ row_colors(result::BicoloringResult) = result.row_color
618624row_groups (result:: BicoloringResult ) = result. row_group
619625
620626function StarSetBicoloringResult (
621- A:: AbstractMatrix , ag:: AdjacencyGraph , symmetric_color:: Vector{Int} , star_set:: StarSet
622- )
627+ A:: AbstractMatrix ,
628+ ag:: AdjacencyGraph{T} ,
629+ color:: Vector{<:Integer} ,
630+ star_set:: StarSet{<:Integer} ,
631+ ) where T
623632 m, n = size (A)
624- num_sym_colors = maximum (symmetric_color )
633+ num_sym_colors = maximum (color )
625634 row_color, column_color, symmetric_to_row, symmetric_to_column = remap_colors (
626- T, symmetric_color , num_sym_colors, m, n
635+ T, color , num_sym_colors, m, n
627636 )
628637 column_group = group_by_color (column_color)
629638 row_group = group_by_color (row_color)
@@ -639,7 +648,7 @@ function StarSetBicoloringResult(
639648 for j in 1 : n
640649 for k in nzrange (S, j)
641650 i = rv[k]
642- l, c = symmetric_coefficient (i, j, symmetric_color , star_set)
651+ l, c = symmetric_coefficient (i, j, color , star_set)
643652 if l ≤ n
644653 # A[i, j] = Br[symmetric_to_row[c], l]
645654 pos_Br += 1
@@ -657,7 +666,7 @@ function StarSetBicoloringResult(
657666 return StarSetBicoloringResult (
658667 A,
659668 ag,
660- symmetric_color ,
669+ color ,
661670 column_color,
662671 row_color,
663672 column_group,
@@ -684,55 +693,61 @@ $TYPEDFIELDS
684693
685694- [`AbstractColoringResult`](@ref)
686695"""
687- struct TreeSetBicoloringResult{M<: AbstractMatrix ,G<: AdjacencyGraph ,V,R} < :
688- AbstractColoringResult{:nonsymmetric ,:bidirectional ,:substitution }
696+ struct TreeSetBicoloringResult{
697+ M<: AbstractMatrix ,
698+ T<: Integer ,
699+ G<: AdjacencyGraph{T} ,
700+ GT<: AbstractGroups{T} ,
701+ SR<: AbstractColoringResult{:symmetric,:column,:substitution} ,
702+ R,
703+ } <: AbstractColoringResult{:nonsymmetric,:bidirectional,:substitution}
689704 " matrix that was colored"
690705 A:: M
691706 " augmented adjacency graph that was used for bicoloring"
692- ag :: G
707+ abg :: G
693708 " one integer color for each axis of the augmented matrix"
694- symmetric_color :: Vector{Int }
709+ color :: Vector{T }
695710 " one integer color for each column"
696- column_color:: Vector{Int }
711+ column_color:: Vector{T }
697712 " one integer color for each row"
698- row_color:: Vector{Int }
713+ row_color:: Vector{T }
699714 " color groups for columns"
700- column_group:: V
715+ column_group:: GT
701716 " color groups for rows"
702- row_group:: V
717+ row_group:: GT
703718 " maps symmetric colors to column colors"
704- symmetric_to_column:: Vector{Int }
719+ symmetric_to_column:: Vector{T }
705720 " maps symmetric colors to row colors"
706- symmetric_to_row:: Vector{Int }
721+ symmetric_to_row:: Vector{T }
707722 " indices of the nonzeros in A that can recovered with Br and Bc"
708- A_indices:: Vector{Int }
723+ A_indices:: Vector{T }
709724 " reverse BFS orders of the trees"
710- reverse_bfs_orders:: Vector{Vector{ Tuple{Int,Int} }}
725+ reverse_bfs_orders:: Vector{Tuple{T,T }}
711726 " buffer needed during acyclic decompression"
712727 buffer:: Vector{R}
713728end
714729
715730function TreeSetBicoloringResult (
716731 A:: AbstractMatrix ,
717- ag:: AdjacencyGraph ,
718- symmetric_color :: Vector{Int } ,
719- tree_set:: TreeSet ,
732+ ag:: AdjacencyGraph{T} ,
733+ color :: Vector{<:Integer } ,
734+ tree_set:: TreeSet{<:Integer} ,
720735 decompression_eltype:: Type{R} ,
721- ) where {R <: Real }
736+ ) where {T,R }
722737 (; reverse_bfs_orders) = tree_set
723738
724739 m, n = size (A)
725- num_sym_colors = maximum (symmetric_color )
740+ num_sym_colors = maximum (color )
726741 row_color, column_color, symmetric_to_row, symmetric_to_column = remap_colors (
727- symmetric_color , num_sym_colors, m, n
742+ T, color , num_sym_colors, m, n
728743 )
729744 column_group = group_by_color (column_color)
730745 row_group = group_by_color (row_color)
731746
732747 S = ag. S
733748 rv = rowvals (S)
734749 nnzA = nnz (S) ÷ 2
735- A_indices = Vector {Int } (undef, nnzA)
750+ A_indices = Vector {T } (undef, nnzA)
736751
737752 index = 0
738753 for k in eachindex (reverse_bfs_orders)
@@ -765,7 +780,7 @@ function TreeSetBicoloringResult(
765780 return TreeSetBicoloringResult (
766781 A,
767782 ag,
768- symmetric_color ,
783+ color ,
769784 column_color,
770785 row_color,
771786 column_group,
0 commit comments