|
| 1 | +using ADTypes: ADTypes |
| 2 | +using SparseArrays |
| 3 | +using SparseMatrixColorings |
| 4 | +using Test |
| 5 | + |
| 6 | +@testset "Column coloring" begin |
| 7 | + problem = ColoringProblem(; structure=:nonsymmetric, partition=:column) |
| 8 | + algo = ADTypes.NoColoringAlgorithm() |
| 9 | + A = sprand(10, 20, 0.1) |
| 10 | + result = coloring(A, problem, algo) |
| 11 | + B = compress(A, result) |
| 12 | + @test size(B) == size(A) |
| 13 | + @test column_colors(result) == ADTypes.column_coloring(A, algo) |
| 14 | + @test decompress(B, result) == A |
| 15 | +end |
| 16 | + |
| 17 | +@testset "Row coloring" begin |
| 18 | + problem = ColoringProblem(; structure=:nonsymmetric, partition=:row) |
| 19 | + algo = ADTypes.NoColoringAlgorithm() |
| 20 | + A = sprand(10, 20, 0.1) |
| 21 | + result = coloring(A, problem, algo) |
| 22 | + B = compress(A, result) |
| 23 | + @test size(B) == size(A) |
| 24 | + @test row_colors(result) == ADTypes.row_coloring(A, algo) |
| 25 | + @test decompress(B, result) == A |
| 26 | +end |
0 commit comments