Skip to content

Commit c3e4863

Browse files
authored
Merge pull request #135 from jw3126/fix0.6
Fix0.6
2 parents ac5475d + 07d8c48 commit c3e4863

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+277
-260
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: julia
22
sudo: false
33
julia:
4-
- 0.4
54
- 0.5
5+
- release
66
- nightly
77
matrix:
88
- allow_failures:

perf/plot_shootout.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ pGc = plot(dfGconstr, xgroup="dim", ygroup="ord", x="name", y="t", Geom.subplot_
3636
draw(PNG("constructionG.png", plotsize...), pGc)
3737

3838
pGr = plot(dfGeval, xgroup="dim", ygroup="ord", x="name", y="rate", Geom.subplot_grid(Geom.point), Scale.y_sqrt, Guide.ylabel("Throughput (pts/s) by order"))
39-
draw(PNG("rateG.png", plotsize...), pGr)
39+
draw(PNG("rateG.png", plotsize...), pGr)

perf/run_shootout.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ stuff!(x, index::CartesianIndex{4}) = (x[1] = index[1]; x[2] = index[2]; x[3] =
7777

7878
function evaluate_grid(grid::GridInterpolations.RectangleGrid, A)
7979
T = eltype(A)
80-
x = Array(eltype(T), ndims(A)) # in case T is RGB{Float32}
80+
x = Array{eltype(T)}( ndims(A)) # in case T is RGB{Float32}
8181
s = zero(T) + zero(T)
8282
vA = vec(A)
8383
for I in iterrange(A)
@@ -92,10 +92,10 @@ ax_constr(A) = ApproXD.Lininterp(A, Vector{Float64}[make_knots(A)...])
9292

9393
function evaluate_grid(grid::ApproXD.Lininterp, A)
9494
T = eltype(A)
95-
x = Array(eltype(T), ndims(A)) # in case T is RGB{Float32}
95+
x = Array{eltype(T)}( ndims(A)) # in case T is RGB{Float32}
9696
s = zero(T) + zero(T)
9797
vA = vec(A)
98-
result = Array(T,1)
98+
result = Array{T}(1)
9999
which = [1]
100100
for I in iterrange(A)
101101
stuff!(x, I)
@@ -181,4 +181,4 @@ for ieltype = 1:length(eltypes)
181181
end
182182
end
183183
end
184-
end
184+
end

src/Interpolations-old.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ stagedfunction gradient!{T,N,TCoefs,TOut,IT,EB}(g::Vector{TOut}, itp::Interpolat
222222
end
223223
end
224224

225-
gradient{T,N}(itp::Interpolation{T,N}, x...) = gradient!(Array(T,N), itp, x...)
225+
gradient{T,N}(itp::Interpolation{T,N}, x...) = gradient!(Array{T}(N), itp, x...)
226226

227227
# This creates prefilter specializations for all interpolation types that need them
228228
stagedfunction prefilter{TWeights,TCoefs,N,IT<:Quadratic}(::Type{TWeights}, A::Array{TCoefs,N}, it::IT)
@@ -258,4 +258,4 @@ end
258258

259259
nindexes(N::Int) = N == 1 ? "1 index" : "$N indexes"
260260

261-
end # module
261+
end # module

src/Interpolations.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ export
3535
using Compat
3636
using WoodburyMatrices, Ratios, AxisAlgorithms
3737

38-
import Base: convert, size, getindex, gradient, scale, promote_rule, ndims, eltype
38+
import Base: convert, size, getindex, gradient, promote_rule, ndims, eltype
39+
40+
# Julia v0.5 compatibility
41+
if isdefined(:scaling) import Base.scaling end
42+
if isdefined(:scale) import Base.scale end
3943

4044
abstract Flag
4145
abstract InterpolationType <: Flag

src/b-splines/b-splines.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@ function interpolate!{IT<:DimSpec{BSpline},GT<:DimSpec{GridType}}(A::AbstractArr
7373
interpolate!(tweight(A), A, it, gt)
7474
end
7575

76+
offsetsym(off, d) = off == -1 ? Symbol("ixm_", d) :
77+
off == 0 ? Symbol("ix_", d) :
78+
off == 1 ? Symbol("ixp_", d) :
79+
off == 2 ? Symbol("ixpp_", d) : error("offset $off not recognized")
80+
7681
include("constant.jl")
7782
include("linear.jl")
7883
include("quadratic.jl")
7984
include("cubic.jl")
8085
include("indexing.jl")
8186
include("prefiltering.jl")
82-
include("../filter1d.jl")
87+
include("../filter1d.jl")

src/b-splines/constant.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ function index_gen{IT<:DimSpec{BSpline}}(::Type{BSpline{Constant}}, ::Type{IT},
5050
indices = [offsetsym(offsets[d], d) for d = 1:N]
5151
return :(itp.coefs[$(indices...)])
5252
end
53-
end
53+
end

src/b-splines/cubic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,4 +316,4 @@ function prefiltering_system{T,TC,GT<:GridType}(::Type{T}, ::Type{TC}, n::Int,
316316
)
317317

318318
Woodbury(lufact!(Tridiagonal(dl, d, du), Val{false}), specs...), zeros(TC, n)
319-
end
319+
end

src/b-splines/indexing.jl

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Base.Cartesian
2+
using DualNumbers
23

34
import Base.getindex
45

@@ -54,7 +55,7 @@ function gradient_impl{T,N,TCoefs,IT<:DimSpec{BSpline},GT<:DimSpec{GridType},Pad
5455
# For each component of the gradient, alternately calculate
5556
# coefficients and set component
5657
n = count_interp_dims(IT, N)
57-
exs = Array(Expr, 2n)
58+
exs = Array{Expr, 1}(2n)
5859
cntr = 0
5960
for d = 1:N
6061
if count_interp_dims(iextract(IT, d), 1) > 0
@@ -79,14 +80,13 @@ function gradient_impl{T,N,TCoefs,IT<:DimSpec{BSpline},GT<:DimSpec{GridType},Pad
7980
end
8081
end
8182

82-
function getindex_return_type{T,N,TCoefs,IT<:DimSpec{BSpline},GT<:DimSpec{GridType},Pad}(::Type{BSplineInterpolation{T,N,TCoefs,IT,GT,Pad}}, argtypes)
83-
Tret = eltype(TCoefs)
84-
for a in argtypes
85-
Tret = Base.promote_op(@functorize(*), Tret, a) # the macro is used to support julia 0.4
86-
end
87-
Tret
88-
end
83+
# there is a Heisenbug, when Base.promote_op is inlined into getindex_return_type
84+
# thats why we use this @noinline fence
85+
@noinline _promote_mul(a,b) = Base.promote_op(@functorize(*), a, b)
8986

87+
@noinline function getindex_return_type{T,N,TCoefs,IT<:DimSpec{BSpline},GT<:DimSpec{GridType},Pad}(::Type{BSplineInterpolation{T,N,TCoefs,IT,GT,Pad}}, argtypes)
88+
reduce(_promote_mul, eltype(TCoefs), argtypes)
89+
end
9090

9191
@generated function gradient!{T,N}(g::AbstractVector, itp::BSplineInterpolation{T,N}, xs::Number...)
9292
length(xs) == N || error("Can only be called with $N indexes")
@@ -104,7 +104,7 @@ for R in [:Real, :Any]
104104
n = count_interp_dims(itp, N)
105105
Tg = promote_type(T, [x <: AbstractArray ? eltype(x) : x for x in xs]...)
106106
xargs = [:(xs[$d]) for d in 1:length(xs)]
107-
:(gradient!(Array($Tg,$n), itp, $(xargs...)))
107+
:(gradient!(Array{$Tg, 1}($n), itp, $(xargs...)))
108108
end
109109
end
110110

@@ -153,12 +153,7 @@ end
153153
n = count_interp_dims(itp,N)
154154
TH = promote_type(T, [x <: AbstractArray ? eltype(x) : x for x in xs]...)
155155
xargs = [:(xs[$d]) for d in 1:length(xs)]
156-
:(hessian!(Array($TH,$n,$n), itp, $(xargs...)))
156+
:(hessian!(Array{TH, 2}($n,$n), itp, $(xargs...)))
157157
end
158158

159159
hessian1{T}(itp::AbstractInterpolation{T,1}, x) = hessian(itp, x)[1,1]
160-
161-
offsetsym(off, d) = off == -1 ? Symbol("ixm_", d) :
162-
off == 0 ? Symbol("ix_", d) :
163-
off == 1 ? Symbol("ixp_", d) :
164-
off == 2 ? Symbol("ixpp_", d) : error("offset $off not recognized")

src/b-splines/linear.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ function index_gen{IT<:DimSpec{BSpline}}(::Type{BSpline{Linear}}, ::Type{IT}, N:
100100
indices = [offsetsym(offsets[d], d) for d = 1:N]
101101
return :(itp.coefs[$(indices...)])
102102
end
103-
end
103+
end

0 commit comments

Comments
 (0)