Skip to content

Commit 6e6e63b

Browse files
Merge pull request #1109 from mattsignorelli/gtpsa-3
GTPSA ext new feature compatibility
2 parents 419a2b5 + 9452a55 commit 6e6e63b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ ForwardDiff = "0.10"
8383
FunctionWrappers = "1.0"
8484
FunctionWrappersWrappers = "0.1"
8585
GeneralizedGenerated = "0.3"
86-
GTPSA = "1.3"
86+
GTPSA = "1.4"
8787
LinearAlgebra = "1.9"
8888
Logging = "1.9"
8989
MPI = "0.20"

ext/DiffEqBaseGTPSAExt.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ else
1111
end
1212

1313
value(x::TPS) = scalar(x)
14-
value(::Type{TPS{T}}) where {T} = T
14+
value(::Type{<:TPS{T}}) where {T} = T
1515

1616
ODE_DEFAULT_NORM(u::TPS, t) = normTPS(u)
1717
ODE_DEFAULT_NORM(f::F, u::TPS, t) where {F} = normTPS(f(u))
1818

19-
function ODE_DEFAULT_NORM(u::AbstractArray{TPS{T}}, t) where {T}
20-
x = zero(real(T))
19+
function ODE_DEFAULT_NORM(u::AbstractArray{<:TPS}, t)
20+
x = zero(real(GTPSA.numtype(eltype(u))))
2121
@inbounds @fastmath for ui in u
2222
x += normTPS(ui)^2
2323
end
2424
Base.FastMath.sqrt_fast(x / max(length(u), 1))
2525
end
2626

27-
function ODE_DEFAULT_NORM(f::F, u::AbstractArray{TPS{T}}, t) where {F, T}
28-
x = zero(real(T))
27+
function ODE_DEFAULT_NORM(f::F, u::AbstractArray{<:TPS}, t) where {F}
28+
x = zero(real(GTPSA.numtype(eltype(u))))
2929
@inbounds @fastmath for ui in u
3030
x += normTPS(f(ui))^2
3131
end

test/downstream/gtpsa.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ sol = solve(prob, Tsit5(), reltol=1e-16, abstol=1e-16)
1313

1414
# Parametric GTPSA map
1515
desc = Descriptor(3, 2, 3, 2) # 3 variables 3 parameters, both to 2nd order
16-
dx = vars(desc)
17-
dp = params(desc)
16+
dx = @vars(desc)
17+
dp = @params(desc)
1818
prob_GTPSA = ODEProblem(f!, x .+ dx, (0.0, 1.0), p .+ dp)
1919
sol_GTPSA = solve(prob_GTPSA, Tsit5(), reltol=1e-16, abstol=1e-16)
2020

@@ -50,7 +50,7 @@ prob = DynamicalODEProblem(pdot!, qdot!, [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], (0.0,
5050
sol = solve(prob, Yoshida6(), dt = 1.0, reltol=1e-16, abstol=1e-16)
5151

5252
desc = Descriptor(6, 2) # 6 variables to 2nd order
53-
dx = vars(desc) # identity map
53+
dx = @vars(desc) # identity map
5454
prob_GTPSA = DynamicalODEProblem(pdot!, qdot!, dx[1:3], dx[4:6], (0.0, 25.0))
5555
sol_GTPSA = solve(prob_GTPSA, Yoshida6(), dt = 1.0, reltol=1e-16, abstol=1e-16)
5656

0 commit comments

Comments
 (0)