From ee24612b6dcfaccb8d1d34c104dbdc5991747142 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Tue, 21 May 2024 18:03:26 +0200 Subject: [PATCH 1/2] Bump version --- Project.toml | 2 +- src/adtypes.jl | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 9d7fd38f..77ded31e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SparseMatrixColorings" uuid = "0a514795-09f3-496d-8182-132a7b665d35" authors = ["Guillaume Dalle <22795598+gdalle@users.noreply.github.com>"] -version = "0.1.0" +version = "0.2.0" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" diff --git a/src/adtypes.jl b/src/adtypes.jl index 4469dfba..52d4bbc6 100644 --- a/src/adtypes.jl +++ b/src/adtypes.jl @@ -1,7 +1,7 @@ """ GreedyColoringAlgorithm <: ADTypes.AbstractColoringAlgorithm -Matrix coloring algorithm for sparse Jacobians and Hessians. +Greedy coloring algorithm for sparse Jacobians and Hessians, with configurable vertex order. Compatible with the [ADTypes.jl coloring framework](https://sciml.github.io/ADTypes.jl/stable/#Coloring-algorithm). @@ -13,6 +13,10 @@ Compatible with the [ADTypes.jl coloring framework](https://sciml.github.io/ADTy - [`ADTypes.column_coloring`](@extref ADTypes) and [`ADTypes.row_coloring`](@extref ADTypes) with a partial distance-2 coloring of the bipartite graph - [`ADTypes.symmetric_coloring`](@extref ADTypes) with a star coloring of the adjacency graph + +# See also + +- [`AbstractOrder`](@ref) """ struct GreedyColoringAlgorithm{O<:AbstractOrder} <: ADTypes.AbstractColoringAlgorithm order::O From 98f7fb171aea9b53dd3db4114d01d13e86db7d57 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Tue, 21 May 2024 18:14:12 +0200 Subject: [PATCH 2/2] Add doctest --- docs/Project.toml | 1 + src/adtypes.jl | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index 1dca586a..70d21eb1 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,4 +1,5 @@ [deps] +ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656" SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35" diff --git a/src/adtypes.jl b/src/adtypes.jl index 52d4bbc6..49fd55ff 100644 --- a/src/adtypes.jl +++ b/src/adtypes.jl @@ -14,6 +14,30 @@ Compatible with the [ADTypes.jl coloring framework](https://sciml.github.io/ADTy - [`ADTypes.column_coloring`](@extref ADTypes) and [`ADTypes.row_coloring`](@extref ADTypes) with a partial distance-2 coloring of the bipartite graph - [`ADTypes.symmetric_coloring`](@extref ADTypes) with a star coloring of the adjacency graph +# Example use + +```jldoctest +using ADTypes, SparseMatrixColorings, SparseArrays + +algo = GreedyColoringAlgorithm(SparseMatrixColorings.LargestFirst()) +A = sparse([ + 0 0 1 1 0 + 1 0 0 0 1 + 0 1 1 0 0 + 0 1 1 0 1 +]) +ADTypes.column_coloring(A, algo) + +# output + +5-element Vector{Int64}: + 1 + 2 + 1 + 2 + 3 +``` + # See also - [`AbstractOrder`](@ref)