Skip to content

Commit

Permalink
Compatibility with Interpolations ≥ 0.14.3 (#46)
Browse files Browse the repository at this point in the history
* Edit compat for Interpolations

* Use snake_case constructors of Interpolations
  • Loading branch information
wg030 authored Jun 6, 2024
1 parent 540b6c4 commit 3d4cc19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name = "NumericalIntegration"
uuid = "e7bfaba1-d571-5449-8927-abc22e82249b"
authors = ["dextorious"]
version = "0.3.3"
version = "0.3.4"

[deps]
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"

[compat]
Interpolations = "0.13"
julia = "0.7, 1"
Interpolations = "≥ 0.14.3"

[extras]
HCubature = "19dc6840-f33b-545b-b366-655c7e3ffd49"
Expand Down
6 changes: 3 additions & 3 deletions src/NumericalIntegration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function integrate(X::NTuple{N,AbstractVector}, Y::AbstractArray{T,N}, ::Trapezo
midpnts = map(_midpoints, X)
Δ(x::AbstractVector) = length(x) > 1 ? diff(x) : 1
Δxs = map(Δ, X)
interp = LinearInterpolation(X,Y)
interp = linear_interpolation(X,Y)
f((Δx,x)) = prod(Δx)*interp(x...)
return sum(f, zip(product(Δxs...), product(midpnts...)))
end
Expand All @@ -216,7 +216,7 @@ function integrate(X::NTuple{N,AbstractVector}, Y::AbstractArray{T,N}, ::Trapezo
midpnts = map(_midpoints, X)
Δ(x::AbstractVector) = length(x) > 1 ? x[2] - x[1] : 1
Δx = prod(Δ, X)
interp = LinearInterpolation(X,Y)
interp = linear_interpolation(X,Y)
f(x) = interp(x...)
return Δx*sum(f, product(midpnts...))
end
Expand All @@ -225,7 +225,7 @@ function integrate(X::NTuple{N,AbstractRange}, Y::AbstractArray{T,N}, ::Trapezoi
midpnts = map(_midpoints, X)
Δ(x::AbstractVector) = length(x) > 1 ? step(x) : 1
Δx = prod(Δ, X)
interp = LinearInterpolation(X,Y)
interp = linear_interpolation(X,Y)
f(x) = interp(x...)
return Δx*sum(f, product(midpnts...))
end
Expand Down

0 comments on commit 3d4cc19

Please sign in to comment.