Skip to content

Commit d161bce

Browse files
committed
quick fix: jacobian should default t to 0
1 parent 4f7e622 commit d161bce

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicalSystemsBase"
22
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
33
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
4-
version = "3.12.0"
4+
version = "3.12.1"
55

66
[deps]
77
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"

src/core_systems/jacobian.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import ForwardDiff
66
jacobian(ds::CoreDynamicalSystem)
77
88
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
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
1616
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
1919
at the state `u`, parameters `p` and time `t` and save the result in `J0`.
2020
"""
2121
function 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!(
@@ -41,6 +41,6 @@ end
4141

4242
function _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
4646
end

0 commit comments

Comments
 (0)