Skip to content

michel2323/ColPack.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColPack

This is the Julia interface to ColPack.

Usage

Jacobian coloring by columns

using ColPack
using SparseArrays

# Example matrix/Jacobian
A = [
    [1.0 1.0 0.0 0.0 0.0];
    [0.0 0.0 1.0 0.0 0.0];
    [0.0 1.0 0.0 1.0 0.0];
    [0.0 0.0 0.0 1.0 1.0];
]

A = sparse(A)

# Create adjacency matrix for column coloring
adjA = ColPack.matrix2adjmatrix(A; partition_by_rows=false)

coloring = ColPackColoring(adjA, d1_coloring(), random_ordering())
println("Number of colors: ", length(unique(get_colors(coloring))))
println("Vector of vertex colors: ", get_colors(coloring))