Skip to content

Commit f7acc3f

Browse files
authored
Add precompilation workload (#252)
* Add precompilation workload * Simplest matrix * Bool
1 parent a34cbdd commit f7acc3f

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name = "SparseMatrixColorings"
22
uuid = "0a514795-09f3-496d-8182-132a7b665d35"
33
authors = ["Guillaume Dalle", "Alexis Montoison"]
4-
version = "0.4.19"
4+
version = "0.4.20"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
88
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
99
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
10+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1011
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1112
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1213

@@ -24,6 +25,7 @@ CliqueTrees = "1"
2425
Colors = "0.12.11, 0.13"
2526
DocStringExtensions = "0.8,0.9"
2627
LinearAlgebra = "<0.0.1, 1"
28+
PrecompileTools = "1.2.1"
2729
Random = "<0.0.1, 1"
2830
SparseArrays = "<0.0.1, 1"
2931
julia = "1.10"

src/SparseMatrixColorings.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ using LinearAlgebra:
2727
ldiv!,
2828
parent,
2929
transpose
30+
using PrecompileTools: @compile_workload
3031
using Random: Random, AbstractRNG, default_rng, randperm
3132
using SparseArrays:
3233
SparseArrays,
@@ -39,6 +40,7 @@ using SparseArrays:
3940
nzrange,
4041
rowvals,
4142
sparse,
43+
sprand,
4244
spzeros
4345

4446
include("graph.jl")
@@ -55,6 +57,8 @@ include("check.jl")
5557
include("examples.jl")
5658
include("show_colors.jl")
5759

60+
include("precompile.jl")
61+
5862
export NaturalOrder, RandomOrder, LargestFirst
5963
export DynamicDegreeBasedOrder, SmallestLast, IncidenceDegree, DynamicLargestFirst
6064
export PerfectEliminationOrder

src/precompile.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
for (structure, partition, decompression) in [
2+
(:nonsymmetric, :column, :direct),
3+
(:nonsymmetric, :row, :direct),
4+
(:symmetric, :column, :direct),
5+
(:symmetric, :column, :substitution),
6+
(:nonsymmetric, :bidirectional, :direct),
7+
(:nonsymmetric, :bidirectional, :substitution),
8+
]
9+
A = sparse(Bool[1 0; 0 1])
10+
problem = ColoringProblem(; structure, partition)
11+
algo = GreedyColoringAlgorithm(; decompression, postprocessing=true)
12+
result = coloring(A, problem, algo)
13+
if partition == :bidirectional
14+
Br, Bc = compress(A, result)
15+
decompress(Br, Bc, result)
16+
else
17+
B = compress(A, result)
18+
decompress(B, result)
19+
end
20+
end

0 commit comments

Comments
 (0)