1
1
using BenchmarkTools
2
2
using LinearAlgebra
3
3
using SparseMatrixColorings
4
+ import SparseMatrixColorings as SMC
4
5
using SparseArrays
5
6
using StableRNGs
6
7
@@ -29,13 +30,13 @@ for structure in [:nonsymmetric, :symmetric],
29
30
results = [coloring (A, problem, algo; decompression_eltype= Float64) for A in As]
30
31
Bs = [compress (Float64 .(A), result) for (A, result) in zip (As, results)]
31
32
32
- SUITE[ :coloring ][structure][partition][decompression][ " n= $n " ][ " p= $p " ] = @benchmarkable begin
33
+ bench_col = @benchmarkable begin
33
34
for A in $ As
34
35
coloring (A, $ problem, $ algo)
35
36
end
36
37
end
37
38
38
- SUITE[ :decompress ][structure][partition][decompression][ " n= $n " ][ " p= $p " ] = @benchmarkable begin
39
+ bench_dec = @benchmarkable begin
39
40
for (B, result) in zip ($ Bs, $ results)
40
41
if B isa AbstractMatrix
41
42
decompress (B, result)
@@ -44,4 +45,34 @@ for structure in [:nonsymmetric, :symmetric],
44
45
end
45
46
end
46
47
end
48
+
49
+ SUITE[:coloring ][structure][partition][decompression][" n=$n " ][" p=$p " ] = bench_col
50
+ SUITE[:decompress ][structure][partition][decompression][" n=$n " ][" p=$p " ] = bench_dec
51
+ end
52
+
53
+ for structure in [:nonsymmetric , :symmetric ],
54
+ partition in (structure == :nonsymmetric ? [:column , :row ] : [:column ]),
55
+ order in [LargestFirst (), SmallestLast (), IncidenceDegree (), DynamicLargestFirst ()],
56
+ n in [10 ^ 3 , 10 ^ 5 ],
57
+ p in [2 / n, 5 / n, 10 / n]
58
+
59
+ nb_samples = 5
60
+ As = [sparse (Symmetric (sprand (StableRNG (i), Bool, n, n, p))) for i in 1 : nb_samples]
61
+ if structure == :symmetric
62
+ gs = [SMC. AdjacencyGraph (A) for A in As]
63
+ bench_ord = @benchmarkable begin
64
+ for g in $ gs
65
+ SMC. vertices (g, $ order)
66
+ end
67
+ end
68
+ else
69
+ gs = [SMC. BipartiteGraph (A) for A in As]
70
+ valside = partition == :row ? Val (1 ) : Val (2 )
71
+ bench_ord = @benchmarkable begin
72
+ for g in $ gs
73
+ SMC. vertices (g, $ valside, $ order)
74
+ end
75
+ end
76
+ end
77
+ SUITE[:order ][structure][partition][string (order)][" n=$n " ][" p=$p " ] = bench_ord
47
78
end
0 commit comments