Skip to content

Commit

Permalink
chore(DataInterpolations): fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutosh-b-b committed Oct 13, 2024
1 parent 6330a49 commit 6588747
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/interpolation_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,11 @@ function CubicSpline(u::uType,
6(u[ax..., begin + 1] - u[ax..., begin]) / h[begin + 1])

h_ = reshape(h, ones(Int64, N - 1)..., :)
ax_h = axes(h_)[1:end-1]
ax_h = axes(h_)[1:(end - 1)]
d = 6 * ((u[ax..., 3:(n + 1)] - u[ax..., 2:n]) ./ h_[ax_h..., 3:(n + 1)]) -
6 * ((u[ax..., 2:n] - u[ax..., 1:(n - 1)]) ./ h_[ax_h..., 2:n])
d = cat(typed_zero, d, typed_zero; dims = ndims(d))
d_reshaped = reshape(d, prod(size(d)[1:end-1]), :)
d_reshaped = reshape(d, prod(size(d)[1:(end - 1)]), :)
z = (tA \ d_reshaped')'
z = reshape(z, size(u)...)
linear_lookup = seems_linear(assume_linear_t, t)
Expand Down
2 changes: 1 addition & 1 deletion src/interpolation_methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function _interpolate(A::CubicSpline{<:AbstractArray{T, N}}, t::Number, iguess)
idx = get_idx(A, t, iguess)
Δt₁ = t - A.t[idx]
Δt₂ = A.t[idx + 1] - t
ax = axes(A.z)[1:end-1]
ax = axes(A.z)[1:(end - 1)]
I = (A.z[ax..., idx] * Δt₂^3 + A.z[ax..., idx + 1] * Δt₁^3) / (6A.h[idx + 1])
c₁, c₂ = get_parameters(A, idx)
C = c₁ * Δt₁
Expand Down
4 changes: 2 additions & 2 deletions test/interpolation_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,9 @@ end
@test isapprox(u_test[1, :], sin.(t_test), atol = 1e-3)
@test isapprox(u_test[2, :], cos.(t_test), atol = 1e-3)
end
@testset "AbstractArray{T, 3}" begin
@testset "AbstractArray{T, 3}" begin
f3d(t) = [sin(t) cos(t);
0. cos(2t)]
0.0 cos(2t)]
t = 0.1:0.1:1.0
u3d = f3d.(t)
c = CubicSpline(u3d, t)
Expand Down

0 comments on commit 6588747

Please sign in to comment.