Skip to content

Commit 8f027e8

Browse files
committed
Remove Compat dependency and don't export gradient, gradient!, hessian, hessian!
1 parent 18cc592 commit 8f027e8

35 files changed

+66
-101
lines changed

REQUIRE

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
julia 0.6
1+
julia 0.7
22

3-
ShowItLikeYouBuildIt
43
WoodburyMatrices 0.1.5
54
Ratios
65
AxisAlgorithms 0.3.0
76
OffsetArrays
8-
Compat 0.59

src/Interpolations.jl

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
VERSION < v"0.7.0-beta2.199" && __precompile__()
2-
31
module Interpolations
42

53
export
@@ -8,12 +6,6 @@ export
86
extrapolate,
97
scale,
108

11-
gradient!,
12-
gradient1,
13-
hessian!,
14-
hessian,
15-
hessian1,
16-
179
AbstractInterpolation,
1810
AbstractExtrapolation,
1911

@@ -37,21 +29,12 @@ export
3729
# extrapolation/extrapolation.jl
3830
# scaling/scaling.jl
3931

40-
using Compat
41-
using Compat.LinearAlgebra, Compat.SparseArrays
32+
using LinearAlgebra, SparseArrays
4233
using WoodburyMatrices, Ratios, AxisAlgorithms, OffsetArrays
4334

44-
import Base: convert, size, getindex, promote_rule,
35+
import Base: convert, size, axes, getindex, promote_rule,
4536
ndims, eltype, checkbounds
4637

47-
@static if VERSION < v"0.7.0-DEV.3449"
48-
import Base: gradient
49-
else
50-
import LinearAlgebra: gradient
51-
end
52-
53-
import Compat: axes
54-
5538
abstract type Flag end
5639
abstract type InterpolationType <: Flag end
5740
struct NoInterp <: InterpolationType end

src/b-splines/prefiltering.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ end
2020
padded_similar(::Type{TC}, inds::Tuple{Vararg{Base.OneTo{Int}}}) where TC = Array{TC}(undef, length.(inds))
2121
padded_similar(::Type{TC}, inds) where TC = OffsetArray{TC}(undef, inds)
2222

23-
# despite Compat, julia doesn't support 0.6 copy! with CartesianIndices argument
24-
@static if isdefined(Base, :CartesianIndices)
25-
ct!(coefs, indscp, A, indsA) = copyto!(coefs, CartesianIndices(indscp), A, CartesianIndices(indsA))
26-
else
27-
ct!(coefs, indscp, A, indsA) = copyto!(coefs, CartesianRange(indscp), A, CartesianRange(indsA))
28-
end
23+
ct!(coefs, indscp, A, indsA) = copyto!(coefs, CartesianIndices(indscp), A, CartesianIndices(indsA))
2924

3025
copy_with_padding(A, ::Type{IT}) where {IT} = copy_with_padding(eltype(A), A, IT)
3126
function copy_with_padding(::Type{TC}, A, ::Type{IT}) where {TC,IT<:DimSpec{InterpolationType}}

test/b-splines/constant.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module ConstantTests
22

33
using Interpolations
4-
using Compat.Test
4+
using Test
55

66
# Instantiation
77
N1 = 10

test/b-splines/cubic.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module CubicTests
22

3-
using Compat.Test
3+
using Test
44
using Interpolations
55

66
for (constructor, copier) in ((interpolate, identity), (interpolate!, copy))
@@ -55,8 +55,7 @@ end
5555

5656
module CubicGradientTests
5757

58-
using Interpolations, Compat.Test, Compat.LinearAlgebra
59-
using Compat: range
58+
using Interpolations, Test, LinearAlgebra
6059

6160
ix = 1:15
6261
f(x) = cos((x-1)*2pi/(length(ix)-1))
@@ -71,16 +70,16 @@ for (constructor, copier) in ((interpolate, identity), (interpolate!, copy))
7170
itp = constructor(copier(A), BSpline(Cubic(BC())), GT())
7271
# test that inner region is close to data
7372
for x in range(ix[5], stop=ix[end-4], length=100)
74-
@test (g(x),(gradient(itp,x))[1],atol=cbrt(cbrt(eps(g(x)))))
73+
@test (g(x),(Interpolations.gradient(itp,x))[1],atol=cbrt(cbrt(eps(g(x)))))
7574
end
7675
end
7776
end
7877
itp_flat_g = interpolate(A, BSpline(Cubic(Flat())), OnGrid())
79-
@test ((gradient(itp_flat_g,1))[1],0,atol=eps())
80-
@test ((gradient(itp_flat_g,ix[end]))[1],0,atol=eps())
78+
@test ((Interpolations.gradient(itp_flat_g,1))[1],0,atol=eps())
79+
@test ((Interpolations.gradient(itp_flat_g,ix[end]))[1],0,atol=eps())
8180

8281
itp_flat_c = interpolate(A, BSpline(Cubic(Flat())), OnCell())
83-
@test ((gradient(itp_flat_c,0.5))[1],0,atol=eps())
84-
@test ((gradient(itp_flat_c,ix[end] + 0.5))[1],0,atol=eps())
82+
@test ((Interpolations.gradient(itp_flat_c,0.5))[1],0,atol=eps())
83+
@test ((Interpolations.gradient(itp_flat_c,ix[end] + 0.5))[1],0,atol=eps())
8584

8685
end

test/b-splines/function-call-syntax.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module ExtrapFunctionCallSyntax
22

3-
using Compat.Test, Interpolations, DualNumbers
4-
using Compat: range
3+
using Test, Interpolations, DualNumbers
54

65
# Test if b-spline interpolation by function syntax yields identical results
76
f(x) = sin((x-3)*2pi/9 - 1)

test/b-splines/linear.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module LinearTests
22

33
using Interpolations
4-
using Compat.Test
4+
using Test
55

66
xmax = 10
77
g1(x) = sin((x-3)*2pi/(xmax-1)-1)

test/b-splines/mixed.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module MixedTests
22

3-
using Interpolations, Compat, Compat.Test, Compat.SharedArrays, Compat.Random
3+
using Interpolations, Test, SharedArrays, Random
44

55
N = 10
66

test/b-splines/multivalued.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module NonNumeric
33
# Test interpolation with a multi-valued type
44

55
using Interpolations
6-
using Compat
76

87
import Base: +, -, *, /
98

test/b-splines/non1.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Non1Tests
22

3-
using Interpolations, OffsetArrays, AxisAlgorithms, Compat.Test
4-
using Compat: axes
3+
using Interpolations, OffsetArrays, AxisAlgorithms, Test
54

65
# At present, for a particular type of non-1 array you need to specialize this function
76
function AxisAlgorithms.A_ldiv_B_md!(dest::OffsetArray, F, src::OffsetArray, dim::Integer, b::AbstractVector)

0 commit comments

Comments
 (0)