Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name = "SparseMatrixColorings"
uuid = "0a514795-09f3-496d-8182-132a7b665d35"
authors = ["Guillaume Dalle", "Alexis Montoison"]
version = "0.4.19"
version = "0.4.20"

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

Expand All @@ -24,6 +25,7 @@ CliqueTrees = "1"
Colors = "0.12.11, 0.13"
DocStringExtensions = "0.8,0.9"
LinearAlgebra = "<0.0.1, 1"
PrecompileTools = "1.2.1"
Random = "<0.0.1, 1"
SparseArrays = "<0.0.1, 1"
julia = "1.10"
4 changes: 4 additions & 0 deletions src/SparseMatrixColorings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ using LinearAlgebra:
ldiv!,
parent,
transpose
using PrecompileTools: @compile_workload
using Random: Random, AbstractRNG, default_rng, randperm
using SparseArrays:
SparseArrays,
Expand All @@ -39,6 +40,7 @@ using SparseArrays:
nzrange,
rowvals,
sparse,
sprand,
spzeros

include("graph.jl")
Expand All @@ -55,6 +57,8 @@ include("check.jl")
include("examples.jl")
include("show_colors.jl")

include("precompile.jl")

export NaturalOrder, RandomOrder, LargestFirst
export DynamicDegreeBasedOrder, SmallestLast, IncidenceDegree, DynamicLargestFirst
export PerfectEliminationOrder
Expand Down
20 changes: 20 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
for (structure, partition, decompression) in [
(:nonsymmetric, :column, :direct),
(:nonsymmetric, :row, :direct),
(:symmetric, :column, :direct),
(:symmetric, :column, :substitution),
(:nonsymmetric, :bidirectional, :direct),
(:nonsymmetric, :bidirectional, :substitution),
]
A = sparse(Bool[1 0; 0 1])
problem = ColoringProblem(; structure, partition)
algo = GreedyColoringAlgorithm(; decompression, postprocessing=true)
result = coloring(A, problem, algo)
if partition == :bidirectional
Br, Bc = compress(A, result)
decompress(Br, Bc, result)
else
B = compress(A, result)
decompress(B, result)
end
end