@@ -5,6 +5,80 @@ using SparseArrays: SparseMatrixCSC, rowvals, nnz, nzrange
55using CUDA: CuVector, CuMatrix
66using cuSPARSE: AbstractCuSparseMatrix, CuSparseMatrixCSC, CuSparseMatrixCSR
77
8+ # # CSC Result
9+
10+ function SMC. ColumnColoringResult (
11+ A:: CuSparseMatrixCSC , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
12+ ) where {T<: Integer }
13+ group = SMC. group_by_color (T, color)
14+ compressed_indices = SMC. column_csc_indices (bg, color)
15+ additional_info = (; compressed_indices_gpu_csc= CuVector (compressed_indices))
16+ return SMC. ColumnColoringResult (
17+ A, bg, color, group, compressed_indices, additional_info
18+ )
19+ end
20+
21+ function SMC. RowColoringResult (
22+ A:: CuSparseMatrixCSC , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
23+ ) where {T<: Integer }
24+ group = SMC. group_by_color (T, color)
25+ compressed_indices = SMC. row_csc_indices (bg, color)
26+ additional_info = (; compressed_indices_gpu_csc= CuVector (compressed_indices))
27+ return SMC. RowColoringResult (A, bg, color, group, compressed_indices, additional_info)
28+ end
29+
30+ function SMC. StarSetColoringResult (
31+ A:: CuSparseMatrixCSC ,
32+ ag:: SMC.AdjacencyGraph{T} ,
33+ color:: Vector{<:Integer} ,
34+ star_set:: SMC.StarSet{<:Integer} ,
35+ ) where {T<: Integer }
36+ group = SMC. group_by_color (T, color)
37+ compressed_indices = SMC. star_csc_indices (ag, color, star_set)
38+ additional_info = (; compressed_indices_gpu_csc= CuVector (compressed_indices))
39+ return SMC. StarSetColoringResult (
40+ A, ag, color, group, compressed_indices, additional_info
41+ )
42+ end
43+
44+ # # CSR Result
45+
46+ function SMC. ColumnColoringResult (
47+ A:: CuSparseMatrixCSR , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
48+ ) where {T<: Integer }
49+ group = SMC. group_by_color (T, color)
50+ compressed_indices = SMC. column_csc_indices (bg, color)
51+ compressed_indices_csr = SMC. column_csr_indices (bg, color)
52+ additional_info = (; compressed_indices_gpu_csr= CuVector (compressed_indices_csr))
53+ return SMC. ColumnColoringResult (
54+ A, bg, color, group, compressed_indices, additional_info
55+ )
56+ end
57+
58+ function SMC. RowColoringResult (
59+ A:: CuSparseMatrixCSR , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
60+ ) where {T<: Integer }
61+ group = SMC. group_by_color (T, color)
62+ compressed_indices = SMC. row_csc_indices (bg, color)
63+ compressed_indices_csr = SMC. row_csr_indices (bg, color)
64+ additional_info = (; compressed_indices_gpu_csr= CuVector (compressed_indices_csr))
65+ return SMC. RowColoringResult (A, bg, color, group, compressed_indices, additional_info)
66+ end
67+
68+ function SMC. StarSetColoringResult (
69+ A:: CuSparseMatrixCSR ,
70+ ag:: SMC.AdjacencyGraph{T} ,
71+ color:: Vector{<:Integer} ,
72+ star_set:: SMC.StarSet{<:Integer} ,
73+ ) where {T<: Integer }
74+ group = SMC. group_by_color (T, color)
75+ compressed_indices = SMC. star_csc_indices (ag, color, star_set)
76+ additional_info = (; compressed_indices_gpu_csr= CuVector (compressed_indices))
77+ return SMC. StarSetColoringResult (
78+ A, ag, color, group, compressed_indices, additional_info
79+ )
80+ end
81+
882# # Decompression
983
1084for R in (:ColumnColoringResult , :RowColoringResult )
0 commit comments