Skip to content

Commit

Permalink
Actually fix all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Dec 3, 2024
1 parent 321e70f commit b401b03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
5 changes: 0 additions & 5 deletions src/derivatives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ function _derivative(A::SmoothedConstantInterpolation{<:AbstractVector}, t::Numb
idx = get_idx(A, t, iguess)
d_lower, d_upper, c_lower, c_upper = get_parameters(A, idx)

# Fix extrapolation behavior as constant for now
if t <= first(A.t) || t >= last(A.t)
return zero(c_upper / oneunit(t))
end

if (t - A.t[idx]) < d_lower
-2c_lower * ((t - A.t[idx]) / d_lower - 1) / d_lower
elseif (A.t[idx + 1] - t) < d_upper
Expand Down
10 changes: 4 additions & 6 deletions src/parameter_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ function smoothed_constant_interpolation_parameters(
if isone(idx) || (idx == length(t))
# If extrapolation is periodic, make the transition differentiable
if extrapolation_left == extrapolation_right == ExtrapolationType.Periodic
if isone(idx)
min(t[end] - t[end - 1], t[2] - t[1], 2d_max) / 2, (u[1] - u[end - 1]) / 2
else
min(t[end] - t[end - 1], t[2] - t[1], 2d_max) / 2, (u[1] - u[end - 1]) / 2
end
min(t[end] - t[end - 1], t[2] - t[1], 2d_max) / 2, (u[1] - u[end - 1]) / 2
else
zero(one(eltype(t)) / 2), zero(one(eltype(u)) / 2)
d = isone(idx) ? min(t[2] - t[1], 2d_max) / 2 :
min(t[end] - t[end - 1], 2d_max) / 2
d, zero(one(eltype(u)) / 2)
end
else
min(t[idx] - t[idx - 1], t[idx + 1] - t[idx], 2d_max) / 2, (u[idx] - u[idx - 1]) / 2
Expand Down

0 comments on commit b401b03

Please sign in to comment.