Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinearInterpolation: Output Vector for u::AbstractMatrix #339

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/parameter_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function linear_interpolation_parameters(u::AbstractArray{T, N}, t, idx) where {
Δu = if N > 1
ax = axes(u)
safe_diff.(
u[ax[1:(end - 1)]..., (idx + 1):(idx + 1)], u[ax[1:(end - 1)]..., idx:idx])
u[ax[1:(end - 1)]..., (idx + 1)], u[ax[1:(end - 1)]..., idx])
else
safe_diff(u[idx + 1], u[idx])
end
Expand Down
8 changes: 4 additions & 4 deletions test/interpolation_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ end
A = LinearInterpolation(u, t; extrapolate = true)

for (_t, _u) in zip(t, eachcol(u))
@test A(_t) == reshape(_u, :, 1)
@test A(_t) == _u
end
@test A(0) == [0.0; 0.0;;]
@test A(5.5) == [11.0; 16.5;;]
@test A(11) == [22; 33;;]
@test A(0) == [0.0, 0.0]
@test A(5.5) == [11.0, 16.5]
@test A(11) == [22, 33]

x = 1:10
y = 2:4
Expand Down
Loading