You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Options for sparsity pattern detection and coloring
36
+
34
37
The backends available for sparse derivatives (`SparseADJacobian`, `SparseEnzymeADJacobian`, `SparseADHessian`, `SparseReverseADHessian`, and `SparseEnzymeADHessian`) allow for customization through keyword arguments such as `detector` and `coloring_algorithm`.
35
38
These arguments specify the sparsity pattern detector and the coloring algorithm, respectively.
36
39
37
40
- A **`detector`** must be of type `ADTypes.AbstractSparsityDetector`.
38
41
The default detector is `TracerSparsityDetector()` from the package `SparseConnectivityTracer.jl`.
39
42
Prior to version 0.8.0, the default was `SymbolicSparsityDetector()` from `Symbolics.jl`.
43
+
A `TracerLocalSparsityDetector()` is also available and can be used if the sparsity pattern of Jacobians and Hessians depends on `x`.
- A **`coloring_algorithm`** must be of type `SparseMatrixColorings.GreedyColoringAlgorithm`.
42
56
The default algorithm is `GreedyColoringAlgorithm{:direct}()` for `SparseADJacobian`, `SparseEnzymeADJacobian` and `SparseADHessian`, while it is `GreedyColoringAlgorithm{:substitution}()` for `SparseReverseADHessian` and `SparseEnzymeADHessian`.
43
57
These algorithms are provided by the package `SparseMatrixColorings.jl`.
The `GreedyColoringAlgorithm{:direct}()` performs column coloring for Jacobians and star coloring for Hessians.
46
69
In contrast, `GreedyColoringAlgorithm{:substitution}()` applies acyclic coloring for Hessians. The `:substitution` mode generally requires fewer colors than `:direct`, thus fewer directional derivatives are needed to reconstruct the sparse Hessian.
47
70
However, it necessitates storing the compressed sparse Hessian, while `:direct` coloring only requires storage for one column of the compressed Hessian.
0 commit comments