diff --git a/README.md b/README.md index d39b011..4de29ee 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,8 @@ Coloring vectors are allowed to be supplied to the Jacobian routines, and these the directional derivatives for constructing the Jacobian. For example, an accurate NxN tridiagonal Jacobian can be computed in just 4 `f` calls by using `colorvec=repeat(1:3,NĂ·3)`. For information on automatically generating coloring -vectors of sparse matrices, see [SparseDiffTools.jl](https://github.com/JuliaDiff/SparseDiffTools.jl). - -Hessian coloring support is coming soon! +vectors of sparse matrices, see [SparseMatrixColorings.jl](https://github.com/gdalle/SparseMatrixColorings.jl) and +the now deprecated [SparseDiffTools.jl](https://github.com/JuliaDiff/SparseDiffTools.jl). ## Contributing diff --git a/docs/src/jacobians.md b/docs/src/jacobians.md index 3e9333b..1be2b2e 100644 --- a/docs/src/jacobians.md +++ b/docs/src/jacobians.md @@ -14,7 +14,8 @@ Jacobians support the following function signatures: FiniteDiff.jl provides efficient sparse Jacobian computation using graph coloring: - Pass a `colorvec` of matrix colors to enable column compression -- Provide `sparsity` as a sparse or structured matrix (`Tridiagonal`, `Banded`, etc.) +- Provide `sparsity` as a sparse (e.g. the default `SparseMatrixCSC`) + or structured matrix (`Tridiagonal`, `Banded`, etc.) - Supports automatic sparsity pattern detection via ArrayInterfaceCore.jl - Results are automatically decompressed unless `sparsity=nothing` diff --git a/docs/src/tutorials.md b/docs/src/tutorials.md index 44f797d..e3a2989 100644 --- a/docs/src/tutorials.md +++ b/docs/src/tutorials.md @@ -100,23 +100,29 @@ etc. all work. Now let's exploit sparsity. If we knew the sparsity pattern we could write it down analytically as a sparse matrix, but let's assume we don't. Thus we can -use [SparsityDetection.jl](https://github.com/JuliaDiffEq/SparsityDetection.jl) +use [SparseConnectivityTracer.jl](https://github.com/adrhill/SparseConnectivityTracer.jl) to automatically get the sparsity pattern of the Jacobian as a sparse matrix: ```julia -using SparsityDetection, SparseArrays +using SparseConnectivityTracer, SparseArrays in = rand(10) out = similar(in) -sparsity_pattern = sparsity!(f,out,in) + +detector = TracerSparsityDetector() +sparsity_pattern = jacobian_sparsity(f,out,in,detector) + sparsejac = Float64.(sparse(sparsity_pattern)) ``` -Then we can use [SparseDiffTools.jl](https://github.com/JuliaDiffEq/SparseDiffTools.jl) +Then we can use [SparseMatrixColorings.jl](https://github.com/gdalle/SparseMatrixColorings.jl) to get the color vector: ```julia -using SparseDiffTools -colors = matrix_colors(sparsejac) +using SparseMatrixColorings +coloring_prob = ColoringProblem(; structure = :nonsymmetric, partition = :column) +coloring_alg = GreedyColoringAlgorithm(; decompression = :direct) +coloring_result = coloring(sparsejac, coloring_prob, coloring_alg) +colors = column_colors(coloring_result) ``` Now we can do sparse differentiation by passing the color vector and the sparsity