|
1 | 1 | # convenience copnstructors for linear / cubic spline interpolations
|
2 | 2 | # 1D version
|
3 |
| -LinearInterpolation(range::T, vs; extrapolation_bc = Throw()) where {T <: AbstractRange} = extrapolate(scale(interpolate(vs, BSpline(Linear())), range), extrapolation_bc) |
4 |
| -LinearInterpolation(range::T, vs; extrapolation_bc = Throw()) where {T <: AbstractArray} = extrapolate(interpolate((range, ), vs, Gridded(Linear())), extrapolation_bc) |
5 |
| -CubicSplineInterpolation(range::T, vs; bc = Line(OnGrid()), extrapolation_bc = Throw()) where {T <: AbstractRange} = extrapolate(scale(interpolate(vs, BSpline(Cubic(bc))), range), extrapolation_bc) |
| 3 | +LinearInterpolation(range::AbstractRange, vs::AbstractVector; extrapolation_bc = Throw()) = |
| 4 | + extrapolate(scale(interpolate(vs, BSpline(Linear())), range), extrapolation_bc) |
| 5 | +LinearInterpolation(range::AbstractVector, vs::AbstractVector; extrapolation_bc = Throw()) = |
| 6 | + extrapolate(interpolate((range, ), vs, Gridded(Linear())), extrapolation_bc) |
| 7 | +CubicSplineInterpolation(range::AbstractRange, vs::AbstractVector; |
| 8 | + bc = Line(OnGrid()), extrapolation_bc = Throw()) = |
| 9 | + extrapolate(scale(interpolate(vs, BSpline(Cubic(bc))), range), extrapolation_bc) |
6 | 10 |
|
7 | 11 | # multivariate versions
|
8 |
| -LinearInterpolation(ranges::NTuple{N,T}, vs; extrapolation_bc = Throw()) where {N,T <: AbstractRange} = extrapolate(scale(interpolate(vs, BSpline(Linear())), ranges...), extrapolation_bc) |
9 |
| -LinearInterpolation(ranges::NTuple{N,T}, vs; extrapolation_bc = Throw()) where {N,T <: AbstractArray} = extrapolate(interpolate(ranges, vs, Gridded(Linear())), extrapolation_bc) |
10 |
| -CubicSplineInterpolation(ranges::NTuple{N,T}, vs; bc = Line(OnGrid()), extrapolation_bc = Throw()) where {N,T <: AbstractRange} = extrapolate(scale(interpolate(vs, BSpline(Cubic(bc))), ranges...), extrapolation_bc) |
| 12 | +LinearInterpolation(ranges::NTuple{N,AbstractRange}, vs::AbstractArray{T,N}; |
| 13 | + extrapolation_bc = Throw()) where {N,T} = |
| 14 | + extrapolate(scale(interpolate(vs, BSpline(Linear())), ranges...), extrapolation_bc) |
| 15 | +LinearInterpolation(ranges::NTuple{N,AbstractVector}, vs::AbstractArray{T,N}; |
| 16 | + extrapolation_bc = Throw()) where {N,T} = |
| 17 | + extrapolate(interpolate(ranges, vs, Gridded(Linear())), extrapolation_bc) |
| 18 | +CubicSplineInterpolation(ranges::NTuple{N,AbstractRange}, vs::AbstractArray{T,N}; |
| 19 | + bc = Line(OnGrid()), extrapolation_bc = Throw()) where {N,T} = |
| 20 | + extrapolate(scale(interpolate(vs, BSpline(Cubic(bc))), ranges...), extrapolation_bc) |
0 commit comments