Skip to content

Commit

Permalink
Merge pull request #400 from SouthEndMusic/fix_pchip
Browse files Browse the repository at this point in the history
Fix PCHIP du computation
  • Loading branch information
ChrisRackauckas authored Mar 7, 2025
2 parents bfcbae1 + 67c6e81 commit 7cfc72d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/interpolation_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ function get_parameters(A::QuinticHermiteSpline, idx)
end

function du_PCHIP(u, t)
h = diff(u)
δ = h ./ diff(t)
h = diff(t)
δ = diff(u) ./ h
s = sign.(δ)

function _du(k)
Expand All @@ -255,7 +255,7 @@ function du_PCHIP(u, t)
else
w₁ = 2h[k] + h[k - 1]
w₂ = h[k] + 2h[k - 1]
δ[k - 1] * δ[k] * (w₁ + w₂) / (w₁ * δ[k] + w₂ * δ[k - 1])
(w₁ + w₂) / (w₁ / δ[k - 1] + w₂ / δ[k])
end
else
zero(eltype(δ))
Expand Down

0 comments on commit 7cfc72d

Please sign in to comment.