Skip to content

Commit 85ca4b6

Browse files
Tomas LyckenTomas Lycken
authored andcommitted
Fix function overwrite warning in tests
1 parent 0f31ad3 commit 85ca4b6

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/scaling/scaling.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ basetype(sitp::ScaledInterpolation) = basetype(typeof(sitp))
7070

7171
# @eval uglyness required for disambiguation with method in b-splies/indexing.jl
7272
# also, GT is only specified to avoid disambiguation warnings on julia 0.4
73-
gradient{T,N,ITPT,IT<:DimSpec{InterpolationType}}(sitp::ScaledInterpolation{T,N,ITPT,IT}, xs::Real...) = gradient!(Array(T,count_interp_dims(IT,N)), sitp, xs...)
74-
gradient{T,N,ITPT,IT<:DimSpec{InterpolationType}}(sitp::ScaledInterpolation{T,N,ITPT,IT}, xs...) = gradient!(Array(T,count_interp_dims(IT,N)), sitp, xs...)
75-
73+
gradient{T,N,ITPT,IT<:DimSpec{InterpolationType},GT<:DimSpec{GridType}}(sitp::ScaledInterpolation{T,N,ITPT,IT,GT}, xs::Real...) =
74+
gradient!(Array(T,count_interp_dims(IT,N)), sitp, xs...)
75+
gradient{T,N,ITPT,IT<:DimSpec{InterpolationType},GT<:DimSpec{GridType}}(sitp::ScaledInterpolation{T,N,ITPT,IT,GT}, xs...) =
76+
gradient!(Array(T,count_interp_dims(IT,N)), sitp, xs...)
7677
@generated function gradient!{T,N,ITPT,IT}(g, sitp::ScaledInterpolation{T,N,ITPT,IT}, xs::Number...)
7778
ndims(g) == 1 || throw(DimensionMismatch("g must be a vector (but had $(ndims(g)) dimensions)"))
7879
length(xs) == N || throw(DimensionMismatch("Must index into $N-dimensional scaled interpolation object with exactly $N indices (you used $(length(xs)))"))

test/b-splines/linear.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@ using Base.Test
66
xmax = 10
77
g1(x) = sin((x-3)*2pi/(xmax-1)-1)
88
f(x) = g1(x)
9-
109
A1 = Float64[f(x) for x in 1:xmax]
10+
fr(x) = (x^2) // 40 + 2
11+
12+
ymax = 10
13+
g2(y) = cos(y/6)
14+
f(x,y) = g1(x)*g2(y)
15+
A2 = Float64[f(x,y) for x in 1:xmax, y in 1:ymax]
1116

12-
for (constructor, copier) in ((interpolate, x->x), (interpolate!, copy))
17+
for (constructor, copier) in ((interpolate, _->_), (interpolate!, copy))
1318
itp1c = @inferred(constructor(copier(A1), BSpline(Linear()), OnCell()))
1419

1520
# Just interpolation
1621
for x in 1:.2:xmax
1722
@test_approx_eq_eps f(x) itp1c[x] abs(.1*f(x))
1823
end
1924

20-
# Rational element types
21-
fr(x) = (x^2) // 40 + 2
25+
# Rational element types
2226
A1R = Rational{Int}[fr(x) for x in 1:10]
2327
itp1r = @inferred(constructor(copier(A1R), BSpline(Linear()), OnGrid()))
2428
@test @inferred(size(itp1r)) == size(A1R)
@@ -27,10 +31,6 @@ for (constructor, copier) in ((interpolate, x->x), (interpolate!, copy))
2731
@test eltype(itp1r) == Rational{Int}
2832

2933
# 2D
30-
g2(y) = cos(y/6)
31-
f(x,y) = g1(x)*g2(y)
32-
ymax = 10
33-
A2 = Float64[f(x,y) for x in 1:xmax, y in 1:ymax]
3434
itp2 = @inferred(constructor(copier(A2), BSpline(Linear()), OnGrid()))
3535
@test @inferred(size(itp2)) == size(A2)
3636

0 commit comments

Comments
 (0)