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: README.md
+5-36Lines changed: 5 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,7 @@ like IterativeSolvers.jl for easy and efficient Newton-Krylov implementation. It
10
10
possible to perform matrix coloring, and utilize coloring in Jacobian and Hessian
11
11
construction.
12
12
13
-
Optionally, automatic and numerical differentiation are utilized and the ability to
14
-
automatically detect the sparsity of a function is provided.
13
+
Optionally, automatic and numerical differentiation are utilized.
15
14
16
15
## Example
17
16
@@ -34,12 +33,12 @@ For this function, we know that the sparsity pattern of the Jacobian is a
34
33
`Tridiagonal` matrix. However, if we didn't know the sparsity pattern for
35
34
the Jacobian, we could use the `sparsity!` function to automatically
36
35
detect the sparsity pattern. This function is only available if you
37
-
load Cassette.jl as well. We declare that the function `f` outputs a
36
+
load SparsityDetection.jl as well. We declare that the function `f` outputs a
38
37
vector of length 30 and takes in a vector of length 30, and `sparsity!` spits
39
38
out a `Sparsity` object which we can turn into a `SparseMatrixCSC`:
40
39
41
40
```julia
42
-
usingCassette
41
+
usingSparsityDetection
43
42
sparsity_pattern =sparsity!(f,output,input)
44
43
jac =Float64.(sparse(sparsity_pattern))
45
44
```
@@ -228,9 +227,9 @@ The `numauto` and `autonum` methods both mix numerical and automatic differentia
228
227
the former almost always being more efficient and thus being recommended.
229
228
230
229
Optionally, if you load Zygote.jl, the following `numback`
231
-
and `autoback` methods are available and allow numerical/ForwardDiff over reverse mode
230
+
and `autoback` methods are available and allow numerical/ForwardDiff over reverse mode
232
231
automatic differentiation respectively, where the reverse-mode AD is provided by Zygote.jl.
233
-
Currently these methods are not competitive against `numauto`, but as Zygote.jl gets
232
+
Currently these methods are not competitive against `numauto`, but as Zygote.jl gets
234
233
optimized these will likely be the fastest.
235
234
236
235
```julia
@@ -266,33 +265,3 @@ These all have the same interface, where `J*v` utilizes the out-of-place
266
265
Jacobian-vector or Hessian-vector function, whereas `mul!(res,J,v)` utilizes
267
266
the appropriate in-place versions. To update the location of differentiation
268
267
in the operator, simply mutate the vector `u`: `J.u .= ...`.
269
-
270
-
### Automated Sparsity Detection
271
-
272
-
Automated sparsity detection is provided by the `sparsity!` function. This requires
273
-
`using Cassette` for Requires. The syntax is:
274
-
275
-
```julia
276
-
`sparsity!(f, Y, X, args...; sparsity=Sparsity(length(X), length(Y)), verbose=true)`
277
-
```
278
-
279
-
The arguments are:
280
-
281
-
-`f`: the function
282
-
-`Y`: the output array
283
-
-`X`: the input array
284
-
-`args`: trailing arguments to `f`. They are considered subject to change, unless wrapped as `Fixed(arg)`
285
-
-`S`: (optional) the sparsity pattern
286
-
-`verbose`: (optional) whether to describe the paths taken by the sparsity detection.
287
-
288
-
The function `f` is assumed to take arguments of the form `f(dx,x,args...)`.
289
-
`sparsity!` returns a `Sparsity` object which describes where the non-zeros
290
-
of the Jacobian occur. `sparse(::Sparsity)` transforms the pattern into
291
-
a sparse matrix.
292
-
293
-
This function utilizes non-standard interpretation, which we denote
294
-
combinatoric concolic analysis, to directly realize the sparsity pattern from the program's AST. It requires that the function `f` is a Julia function. It does not
295
-
work numerically, meaning that it is not prone to floating point error or
296
-
cancelation. It allows for branching and will automatically check all of the
297
-
branches. However, a while loop of indeterminate length which is dependent
0 commit comments