@@ -3,13 +3,13 @@ using JET
33using LinearAlgebra
44using SparseArrays
55using SparseMatrixColorings
6- using SparseMatrixColorings: respectful_similar
6+ using SparseMatrixColorings: matrix_versions, respectful_similar
77using StableRNGs
88using Test
99
1010rng = StableRNG (63 )
1111
12- @testset " Coloring " begin
12+ @testset " Sparse coloring " begin
1313 n = 10
1414 A = sprand (rng, n, n, 5 / n)
1515
@@ -40,9 +40,28 @@ rng = StableRNG(63)
4040 GreedyColoringAlgorithm (; decompression),
4141 )
4242 end
43- end
43+ end ;
4444
45- @testset " Decompression" begin
45+ @testset " Structured coloring" begin
46+ n = 10
47+ @testset " $(nameof (typeof (A))) - $structure - $partition - $decompression " for A in [
48+ Diagonal (rand (n)),
49+ Bidiagonal (rand (n), rand (n - 1 ), ' U' ),
50+ Bidiagonal (rand (n), rand (n - 1 ), ' L' ),
51+ Tridiagonal (rand (n - 1 ), rand (n), rand (n - 1 )),
52+ ],
53+ (structure, partition, decompression) in
54+ [(:nonsymmetric , :column , :direct ), (:nonsymmetric , :row , :direct )]
55+
56+ @test_opt target_modules = (SparseMatrixColorings,) coloring (
57+ A,
58+ ColoringProblem (; structure, partition),
59+ GreedyColoringAlgorithm (; decompression),
60+ )
61+ end
62+ end ;
63+
64+ @testset " Sparse decompression" begin
4665 n = 10
4766 A0 = sparse (Symmetric (sprand (rng, n, n, 5 / n)))
4867
92111 end
93112 end
94113end ;
114+
115+ @testset " Structured decompression" begin
116+ n = 10
117+ @testset " $(nameof (typeof (A))) - $structure - $partition - $decompression " for A in [
118+ Diagonal (rand (n)),
119+ Bidiagonal (rand (n), rand (n - 1 ), ' U' ),
120+ Bidiagonal (rand (n), rand (n - 1 ), ' L' ),
121+ Tridiagonal (rand (n - 1 ), rand (n), rand (n - 1 )),
122+ ],
123+ (structure, partition, decompression) in
124+ [(:nonsymmetric , :column , :direct ), (:nonsymmetric , :row , :direct )]
125+
126+ result = coloring (
127+ A,
128+ ColoringProblem (; structure, partition),
129+ GreedyColoringAlgorithm (; decompression);
130+ )
131+ B = compress (A, result)
132+ @test_opt decompress (B, result)
133+ end
134+ end ;
0 commit comments