Skip to content

Commit 9d2d9a7

Browse files
Merge pull request #204 from DanielDoehring/UpdateDocs_Sparsity
Update Docs: Replace `SparseDiffTools.jl` with `SparseConnectivityTracer.jl` and `SparseMatrixColorings.jl`
2 parents 3e64a97 + 1f79574 commit 9d2d9a7

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ Coloring vectors are allowed to be supplied to the Jacobian routines, and these
7171
the directional derivatives for constructing the Jacobian. For example, an accurate
7272
NxN tridiagonal Jacobian can be computed in just 4 `f` calls by using
7373
`colorvec=repeat(1:3,N÷3)`. For information on automatically generating coloring
74-
vectors of sparse matrices, see [SparseDiffTools.jl](https://github.com/JuliaDiff/SparseDiffTools.jl).
75-
76-
Hessian coloring support is coming soon!
74+
vectors of sparse matrices, see [SparseMatrixColorings.jl](https://github.com/gdalle/SparseMatrixColorings.jl) and
75+
the now deprecated [SparseDiffTools.jl](https://github.com/JuliaDiff/SparseDiffTools.jl).
7776

7877
## Contributing
7978

docs/src/jacobians.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Jacobians support the following function signatures:
1414
FiniteDiff.jl provides efficient sparse Jacobian computation using graph coloring:
1515

1616
- Pass a `colorvec` of matrix colors to enable column compression
17-
- Provide `sparsity` as a sparse or structured matrix (`Tridiagonal`, `Banded`, etc.)
17+
- Provide `sparsity` as a sparse (e.g. the default `SparseMatrixCSC`)
18+
or structured matrix (`Tridiagonal`, `Banded`, etc.)
1819
- Supports automatic sparsity pattern detection via ArrayInterfaceCore.jl
1920
- Results are automatically decompressed unless `sparsity=nothing`
2021

docs/src/tutorials.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,29 @@ etc. all work.
100100

101101
Now let's exploit sparsity. If we knew the sparsity pattern we could write it
102102
down analytically as a sparse matrix, but let's assume we don't. Thus we can
103-
use [SparsityDetection.jl](https://github.com/JuliaDiffEq/SparsityDetection.jl)
103+
use [SparseConnectivityTracer.jl](https://github.com/adrhill/SparseConnectivityTracer.jl)
104104
to automatically get the sparsity pattern of the Jacobian as a sparse matrix:
105105

106106
```julia
107-
using SparsityDetection, SparseArrays
107+
using SparseConnectivityTracer, SparseArrays
108108
in = rand(10)
109109
out = similar(in)
110-
sparsity_pattern = sparsity!(f,out,in)
110+
111+
detector = TracerSparsityDetector()
112+
sparsity_pattern = jacobian_sparsity(f,out,in,detector)
113+
111114
sparsejac = Float64.(sparse(sparsity_pattern))
112115
```
113116

114-
Then we can use [SparseDiffTools.jl](https://github.com/JuliaDiffEq/SparseDiffTools.jl)
117+
Then we can use [SparseMatrixColorings.jl](https://github.com/gdalle/SparseMatrixColorings.jl)
115118
to get the color vector:
116119

117120
```julia
118-
using SparseDiffTools
119-
colors = matrix_colors(sparsejac)
121+
using SparseMatrixColorings
122+
coloring_prob = ColoringProblem(; structure = :nonsymmetric, partition = :column)
123+
coloring_alg = GreedyColoringAlgorithm(; decompression = :direct)
124+
coloring_result = coloring(sparsejac, coloring_prob, coloring_alg)
125+
colors = column_colors(coloring_result)
120126
```
121127

122128
Now we can do sparse differentiation by passing the color vector and the sparsity

0 commit comments

Comments
 (0)