Skip to content

Commit 0f8481c

Browse files
value -> normTPS
1 parent 14350ab commit 0f8481c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ext/DiffEqBaseGTPSAExt.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@ end
1313
value(x::TPS) = scalar(x)
1414
value(::Type{TPS{T}}) where {T} = T
1515

16-
ODE_DEFAULT_NORM(u::TPS, t) = @fastmath abs(value(u))
17-
ODE_DEFAULT_NORM(f::F, u::TPS, t) where {F} = @fastmath abs(f(value(u)))
16+
ODE_DEFAULT_NORM(u::TPS, t) = normTPS(u)
17+
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 <: Union{AbstractFloat, Complex}}
19+
function ODE_DEFAULT_NORM(u::AbstractArray{TPS{T}}, t) where {T}
2020
x = zero(real(T))
2121
@inbounds @fastmath for ui in u
22-
x += abs2(value(ui))
22+
x += normTPS(ui)^2
23+
end
24+
Base.FastMath.sqrt_fast(x / max(length(u), 1))
25+
end
26+
27+
function ODE_DEFAULT_NORM(f::F, u::AbstractArray{TPS{T}}, t) where {F, T}
28+
x = zero(real(T))
29+
@inbounds @fastmath for ui in u
30+
x += normTPS(f(ui))^2
2331
end
2432
Base.FastMath.sqrt_fast(x / max(length(u), 1))
2533
end

0 commit comments

Comments
 (0)