Skip to content

Commit

Permalink
format and tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Dec 25, 2022
1 parent a8d86ec commit 4674545
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OrdinaryDiffEq"
uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
authors = ["Chris Rackauckas <[email protected]>", "Yingbo Ma <[email protected]>"]
version = "6.36.0"
version = "6.36.1"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
14 changes: 7 additions & 7 deletions src/derivative_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const FIRST_AUTODIFF_TGRAD_MESSAGE = """
First call to automatic differentiation for time gradient
failed. This means that the user `f` function is not compatible
with automatic differentiation. Methods to fix this include:
1. Turn off automatic differentiation (e.g. Rosenbrock23() becomes
Rosenbrock23(autodiff=false)). More details can befound at
https://docs.sciml.ai/DiffEqDocs/stable/features/performance_overloads/
Expand Down Expand Up @@ -31,8 +31,8 @@ const FIRST_AUTODIFF_TGRAD_MESSAGE = """
algorithm as well.
"""

struct FirstAutodiffTgradError <: Exception
e
struct FirstAutodiffTgradError <: Exception
e::Any
end

function Base.showerror(io::IO, e::FirstAutodiffTgradError)
Expand All @@ -44,7 +44,7 @@ const FIRST_AUTODIFF_JAC_MESSAGE = """
First call to automatic differentiation for the Jacobian
failed. This means that the user `f` function is not compatible
with automatic differentiation. Methods to fix this include:
1. Turn off automatic differentiation (e.g. Rosenbrock23() becomes
Rosenbrock23(autodiff=false)). More details can befound at
https://docs.sciml.ai/DiffEqDocs/stable/features/performance_overloads/
Expand All @@ -66,8 +66,8 @@ const FIRST_AUTODIFF_JAC_MESSAGE = """
algorithm as well.
"""

struct FirstAutodiffJacError <: Exception
e
struct FirstAutodiffJacError <: Exception
e::Any
end

function Base.showerror(io::IO, e::FirstAutodiffJacError)
Expand Down Expand Up @@ -99,7 +99,7 @@ function derivative!(df::AbstractArray{<:Number}, f,
else
f(grad_config, xdual)
end

df .= first.(ForwardDiff.partials.(grad_config))
integrator.destats.nf += 1
else
Expand Down
60 changes: 30 additions & 30 deletions test/interface/autodiff_error_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@ using OrdinaryDiffEq, Test

const a = Float64[1.0]

function lorenz(u,p,t)
du1 = 10.0(u[2]-u[1])
function lorenz(u, p, t)
du1 = 10.0(u[2] - u[1])
a[1] = u[2]
du2 = u[1]*(28.0-u[3]) - u[2]
du3 = u[1]*u[2] - (8/3)*u[3]
[du1,du2,du3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,1.0)
prob = ODEProblem(lorenz,u0,tspan)
@test_throws OrdinaryDiffEq.FirstAutodiffJacError solve(prob,Rosenbrock23())
du2 = u[1] * (28.0 - u[3]) - u[2]
du3 = u[1] * u[2] - (8 / 3) * u[3]
[du1, du2, du3]
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 1.0)
prob = ODEProblem(lorenz, u0, tspan)
@test_throws OrdinaryDiffEq.FirstAutodiffJacError solve(prob, Rosenbrock23())

function lorenz(u,p,t)
du1 = 10.0(u[2]-u[1])
function lorenz(u, p, t)
du1 = 10.0(u[2] - u[1])
a[1] = t
du2 = u[1]*(28.0-u[3]) - u[2]
du3 = u[1]*u[2] - (8/3)*u[3]
[du1,du2,du3]
du2 = u[1] * (28.0 - u[3]) - u[2]
du3 = u[1] * u[2] - (8 / 3) * u[3]
[du1, du2, du3]
end
@test_throws OrdinaryDiffEq.FirstAutodiffTgradError solve(prob,Rosenbrock23())
@test_throws OrdinaryDiffEq.FirstAutodiffTgradError solve(prob, Rosenbrock23())

function lorenz!(du,u,p,t)
du[1] = 10.0(u[2]-u[1])
function lorenz!(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
a[1] = u[2]
du[2] = u[1]*(28.0-u[3]) - u[2]
du[3] = u[1]*u[2] - (8/3)*u[3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,1.0)
prob = ODEProblem(lorenz!,u0,tspan)
@test_throws OrdinaryDiffEq.FirstAutodiffJacError solve(prob,Rosenbrock23())
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 1.0)
prob = ODEProblem(lorenz!, u0, tspan)
@test_throws OrdinaryDiffEq.FirstAutodiffJacError solve(prob, Rosenbrock23())

function lorenz!(du,u,p,t)
du[1] = 10.0(u[2]-u[1])
function lorenz!(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
a[1] = t
du[2] = u[1]*(28.0-u[3]) - u[2]
du[3] = u[1]*u[2] - (8/3)*u[3]
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
@test_throws OrdinaryDiffEq.FirstAutodiffTgradError solve(prob,Rosenbrock23())
@test_throws OrdinaryDiffEq.FirstAutodiffTgradError solve(prob, Rosenbrock23())

0 comments on commit 4674545

Please sign in to comment.