@@ -6,16 +6,16 @@ import ForwardDiff
66 jacobian(ds::CoreDynamicalSystem)
77
88Construct 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
1010[`ForwardDiff`](https://github.com/JuliaDiff/ForwardDiff.jl).
1111
1212## Description
1313
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
1616at 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
1919at the state `u`, parameters `p` and time `t` and save the result in `J0`.
2020"""
2121function jacobian (ds:: CoreDynamicalSystem{IIP} ) where {IIP}
@@ -28,7 +28,7 @@ function _jacobian(ds, ::Val{true})
2828 cfg = ForwardDiff. JacobianConfig (
2929 (du, u) -> f (du, u, p, p), deepcopy (u0), deepcopy (u0)
3030 )
31- Jf! = (J0, u, p, t) -> begin
31+ Jf! = (J0, u, p, t = 0 ) -> begin
3232 uv = @view u[:, 1 ]
3333 du = copy (u)
3434 ForwardDiff. jacobian! (
4141
4242function _jacobian (ds, :: Val{false} )
4343 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)
4545 return Jf
4646end
0 commit comments