Skip to content

Commit 81d3b9d

Browse files
committed
Move indexing related functions into indexing.jl
1 parent be88fca commit 81d3b9d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/b-splines/b-splines.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,6 @@ function interpolate!{IT<:DimSpec{BSpline},GT<:DimSpec{GridType}}(A::AbstractArr
7171
interpolate!(tweight(A), A, IT, GT)
7272
end
7373

74-
define_indices{IT}(::Type{IT}, N, pad) = Expr(:block, Expr[define_indices_d(iextract(IT, d), d, padextract(pad, d)) for d = 1:N]...)
75-
76-
coefficients{IT}(::Type{IT}, N) = Expr(:block, Expr[coefficients(iextract(IT, d), N, d) for d = 1:N]...)
77-
78-
function gradient_coefficients{IT<:DimSpec{BSpline}}(::Type{IT}, N, dim)
79-
exs = Expr[d==dim ? gradient_coefficients(iextract(IT, dim), d) :
80-
coefficients(iextract(IT, d), N, d) for d = 1:N]
81-
Expr(:block, exs...)
82-
end
83-
84-
index_gen{IT}(::Type{IT}, N::Integer, offsets...) = index_gen(iextract(IT, min(length(offsets)+1, N)), IT, N, offsets...)
85-
8674
include("constant.jl")
8775
include("linear.jl")
8876
include("quadratic.jl")

src/b-splines/indexing.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import Base.getindex
44

55
Base.linearindexing{T<:AbstractInterpolation}(::Type{T}) = Base.LinearSlow()
66

7+
define_indices{IT}(::Type{IT}, N, pad) = Expr(:block, Expr[define_indices_d(iextract(IT, d), d, padextract(pad, d)) for d = 1:N]...)
8+
9+
coefficients{IT}(::Type{IT}, N) = Expr(:block, Expr[coefficients(iextract(IT, d), N, d) for d = 1:N]...)
10+
11+
function gradient_coefficients{IT<:DimSpec{BSpline}}(::Type{IT}, N, dim)
12+
exs = Expr[d==dim ? gradient_coefficients(iextract(IT, dim), d) :
13+
coefficients(iextract(IT, d), N, d) for d = 1:N]
14+
Expr(:block, exs...)
15+
end
16+
17+
index_gen{IT}(::Type{IT}, N::Integer, offsets...) = index_gen(iextract(IT, min(length(offsets)+1, N)), IT, N, offsets...)
18+
719
function getindex_impl{T,N,TCoefs,IT<:DimSpec{BSpline},GT<:DimSpec{GridType},Pad}(itp::Type{BSplineInterpolation{T,N,TCoefs,IT,GT,Pad}})
820
meta = Expr(:meta, :inline)
921
quote

0 commit comments

Comments
 (0)