Skip to content

Commit

Permalink
Merge pull request #339 from ashutosh-b-b/bb/fix_linear_interp
Browse files Browse the repository at this point in the history
LinearInterpolation: Output Vector for `u::AbstractMatrix`
  • Loading branch information
ChrisRackauckas authored Oct 4, 2024
2 parents f5742da + 3e0b6b2 commit 7b36a83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit 7b36a83

Please sign in to comment.