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
Copy file name to clipboardExpand all lines: DifferentiationInterface/docs/src/tutorial.md
+19-21Lines changed: 19 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,32 +143,26 @@ It provides benchmarking utilities to compare backends and help you select the o
143
143
144
144
To compute sparse Jacobians or Hessians, you need three ingredients (read [this survey](https://epubs.siam.org/doi/10.1137/S0036144504444711) to understand why):
145
145
146
-
1. A sparsity pattern detector
147
-
2. A coloring algorithm
148
-
3. An underlying AD backend
149
-
150
-
ADTypes.jl v1.0 defines the [`AutoSparse`](@ref) wrapper, which brings together these three ingredients.
151
-
At the moment, this new wrapper is not well-supported in the ecosystem, which is why DifferentiationInterface.jl provides the necessary objects to get you started:
152
-
153
-
1.[`DifferentiationInterface.SymbolicsSparsityDetector`](@ref) (requires [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl) to be loaded)
These objects are not part of the public API, so they can change unexpectedly between versions.
158
-
159
-
!!! info
160
-
The symbolic backends have built-in sparsity handling, so `AutoSparse(AutoSymbolics())` and `AutoSparse(AutoFastDifferentiation())` do not need additional configuration.
161
-
146
+
1. An underlying (dense) AD backend
147
+
2. A sparsity pattern detector like:
148
+
-`TracerSparsityDetector`, implemented by [SparseConnectivityTracer.jl](https://github.com/adrhill/SparseConnectivityTracer.jl) (our default recommendation)
149
+
-[`DifferentiationInterface.SymbolicsSparsityDetector`](@ref), implemented by DifferentiationInterface.jl with [Symbolics.jl](https://github.com/JuliaSymbolics/Symbolics.jl) but not part of the public API (it will soon be [transferred](https://github.com/JuliaSymbolics/Symbolics.jl/pull/1134))
150
+
3. A coloring algorithm like:
151
+
-[`GreedyColoringAlgorithm`](@ref), implemented by DifferentiationInterface.jl
152
+
153
+
ADTypes.jl v1.0 provides the [`AutoSparse`](@ref) wrapper to combine these three ingredients, and DifferentiationInterface.jl re-exports it.
See how the computed Hessian is sparse, whereas the underlying backend alone would give us a dense matrix:
@@ -183,4 +177,8 @@ hessian(f, dense_backend, x)
183
177
184
178
The sparsity detector and coloring algorithm are called during the preparation step, which can be fairly expensive.
185
179
If you plan to compute several Jacobians or Hessians with the same pattern but different input vectors, you should reuse the `extras` object created by `prepare_jacobian` or `prepare_hessian`.
186
-
After preparation, the sparse computation itself will be much faster than the dense one, and require fewer calls to the function.
180
+
After preparation, the sparse computation itself will be much faster than the dense one, and require fewer calls to the function.
181
+
182
+
!!! info
183
+
The symbolic backends have built-in sparsity handling, so `AutoSparse(AutoSymbolics())` and `AutoSparse(AutoFastDifferentiation())` do not need additional configuration for detection or coloring.
0 commit comments