@@ -88,14 +88,14 @@ function _interpolate(A::LagrangeInterpolation{<:AbstractVector}, t::Number, igu
8888end
8989
9090function _interpolate (
91- A:: LagrangeInterpolation{<:AbstractArray{T, N}} , t:: Number , iguess) where {T, N}
91+ A:: LagrangeInterpolation{<:AbstractArray} , t:: Number , iguess)
9292 idx = get_idx (A, t, iguess)
9393 findRequiredIdxs! (A, t, idx)
9494 ax = axes (A. u)[1 : (end - 1 )]
9595 if A. t[A. idxs[1 ]] == t
9696 return A. u[ax... , A. idxs[1 ]]
9797 end
98- N1 = zero (A. u[ax... , 1 ])
98+ N = zero (A. u[ax... , 1 ])
9999 D = zero (A. t[1 ])
100100 tmp = D
101101 for i in 1 : length (A. idxs)
@@ -113,15 +113,22 @@ function _interpolate(
113113 end
114114 tmp = inv ((t - A. t[A. idxs[i]]) * mult)
115115 D += tmp
116- @. N1 += (tmp * A. u[ax... , A. idxs[i]])
116+ @. N += (tmp * A. u[ax... , A. idxs[i]])
117117 end
118- N1 / D
118+ N / D
119119end
120120
121121function _interpolate (A:: AkimaInterpolation{<:AbstractVector} , t:: Number , iguess)
122122 idx = get_idx (A, t, iguess)
123123 wj = t - A. t[idx]
124- @evalpoly wj A. u[idx] A. b[idx] A. c[idx] A. d[idx]
124+ @evalpoly wj A. u[idx] A. p. b[idx] A. p. c[idx] A. p. d[idx]
125+ end
126+
127+ function _interpolate (A:: AkimaInterpolation{<:AbstractArray} , t:: Number , iguess)
128+ idx = get_idx (A, t, iguess)
129+ wj = t - A. t[idx]
130+ ax = axes (A. u)[1 : (end - 1 )]
131+ @. @evalpoly wj A. u[ax... , idx] A. p. b[ax... , idx] A. p. c[ax... , idx] A. p. d[ax... , idx]
125132end
126133
127134# ConstantInterpolation Interpolation
@@ -137,7 +144,7 @@ function _interpolate(A::ConstantInterpolation{<:AbstractVector}, t::Number, igu
137144end
138145
139146function _interpolate (
140- A:: ConstantInterpolation{<:AbstractArray{T, N}} , t:: Number , iguess) where {T, N}
147+ A:: ConstantInterpolation{<:AbstractArray} , t:: Number , iguess)
141148 if A. dir === :left
142149 # :left means that value to the left is used for interpolation
143150 idx = get_idx (A, t, iguess; lb = 1 , ub_shift = 0 )
@@ -158,7 +165,7 @@ function _interpolate(A::QuadraticSpline{<:AbstractVector}, t::Number, iguess)
158165end
159166
160167function _interpolate (
161- A:: QuadraticSpline{<:AbstractArray{T, N}} , t:: Number , iguess) where {T, N}
168+ A:: QuadraticSpline{<:AbstractArray} , t:: Number , iguess)
162169 idx = get_idx (A, t, iguess)
163170 ax = axes (A. u)[1 : (end - 1 )]
164171 Cᵢ = A. u[ax... , idx]
@@ -179,7 +186,7 @@ function _interpolate(A::CubicSpline{<:AbstractVector}, t::Number, iguess)
179186 I + C + D
180187end
181188
182- function _interpolate (A:: CubicSpline{<:AbstractArray{T, N}} , t:: Number , iguess) where {T, N}
189+ function _interpolate (A:: CubicSpline{<:AbstractArray} , t:: Number , iguess)
183190 idx = get_idx (A, t, iguess)
184191 Δt₁ = t - A. t[idx]
185192 Δt₂ = A. t[idx + 1 ] - t
@@ -238,6 +245,18 @@ function _interpolate(
238245 out
239246end
240247
248+ function _interpolate (
249+ A:: CubicHermiteSpline{<:AbstractArray} , t:: Number , iguess)
250+ idx = get_idx (A, t, iguess)
251+ Δt₀ = t - A. t[idx]
252+ Δt₁ = t - A. t[idx + 1 ]
253+ ax = axes (A. u)[1 : (end - 1 )]
254+ out = A. u[ax... , idx] .+ Δt₀ .* A. du[ax... , idx]
255+ c₁, c₂ = get_parameters (A, idx)
256+ out .+ = Δt₀^ 2 .* (c₁ .+ Δt₁ .* c₂)
257+ out
258+ end
259+
241260# Quintic Hermite Spline
242261function _interpolate (
243262 A:: QuinticHermiteSpline{<:AbstractVector{<:Number}} , t:: Number , iguess)
@@ -249,3 +268,15 @@ function _interpolate(
249268 out += Δt₀^ 3 * (c₁ + Δt₁ * (c₂ + c₃ * Δt₁))
250269 out
251270end
271+
272+ function _interpolate (
273+ A:: QuinticHermiteSpline{<:AbstractArray} , t:: Number , iguess)
274+ idx = get_idx (A, t, iguess)
275+ Δt₀ = t - A. t[idx]
276+ Δt₁ = t - A. t[idx + 1 ]
277+ ax = axes (A. u)[1 : (end - 1 )]
278+ out = A. u[ax... , idx] + Δt₀ * (A. du[ax... , idx] + A. ddu[ax... , idx] * Δt₀ / 2 )
279+ c₁, c₂, c₃ = get_parameters (A, idx)
280+ out .+ = Δt₀^ 3 .* (c₁ .+ Δt₁ .* (c₂ .+ c₃ .* Δt₁))
281+ out
282+ end
0 commit comments