@@ -6,16 +6,16 @@ import ForwardDiff
6
6
jacobian(ds::CoreDynamicalSystem)
7
7
8
8
Construct the Jacobian rule for the dynamical system `ds`.
9
- This is done via automatic differentiation using module
9
+ This is done via automatic differentiation using module
10
10
[`ForwardDiff`](https://github.com/JuliaDiff/ForwardDiff.jl).
11
11
12
12
## Description
13
13
14
- For out-of-place systems, `jacobian` returns the Jacobian rule as a
15
- function `Jf(u, p, t) -> J0::SMatrix`. Calling `Jf(u, p, t)` will compute the Jacobian
14
+ For out-of-place systems, `jacobian` returns the Jacobian rule as a
15
+ function `Jf(u, p, t = 0 ) -> J0::SMatrix`. Calling `Jf(u, p, t)` will compute the Jacobian
16
16
at the state `u`, parameters `p` and time `t` and return the result as `J0`.
17
- For in-place systems, `jacobian` returns the Jacobian rule as a function
18
- `Jf!(J0, u, p, t)`. Calling `Jf!(J0, u, p, t )` will compute the Jacobian
17
+ For in-place systems, `jacobian` returns the Jacobian rule as a function
18
+ `Jf!(J0, u, p, t = 0 )`. Calling `Jf!(J0, u, p)` will compute the Jacobian
19
19
at the state `u`, parameters `p` and time `t` and save the result in `J0`.
20
20
"""
21
21
function jacobian (ds:: CoreDynamicalSystem{IIP} ) where {IIP}
@@ -28,7 +28,7 @@ function _jacobian(ds, ::Val{true})
28
28
cfg = ForwardDiff. JacobianConfig (
29
29
(du, u) -> f (du, u, p, p), deepcopy (u0), deepcopy (u0)
30
30
)
31
- Jf! = (J0, u, p, t) -> begin
31
+ Jf! = (J0, u, p, t = 0 ) -> begin
32
32
uv = @view u[:, 1 ]
33
33
du = copy (u)
34
34
ForwardDiff. jacobian! (
41
41
42
42
function _jacobian (ds, :: Val{false} )
43
43
f = dynamic_rule (ds)
44
- Jf = (u, p, t) -> ForwardDiff. jacobian ((x) -> f (x, p, t), u)
44
+ Jf = (u, p, t = 0 ) -> ForwardDiff. jacobian ((x) -> f (x, p, t), u)
45
45
return Jf
46
46
end
0 commit comments