Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/AffineTransforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ struct AffineTransform2D{T<:AbstractFloat} <: Function
yx::T
yy::T
y ::T
(::Type{AffineTransform2D{T}})() where T = new{T}(1,0,0, 0,1,0)
(::Type{AffineTransform2D{T}})(a11::Real, a12::Real, a13::Real,
a21::Real, a22::Real, a23::Real) where T =
AffineTransform2D{T}() where T = new{T}(1,0,0, 0,1,0)
AffineTransform2D{T}(a11::Real, a12::Real, a13::Real,
a21::Real, a22::Real, a23::Real) where T =
new{T}(a11,a12,a13, a21,a22,a23)
end

Expand Down Expand Up @@ -174,7 +174,7 @@ function Base.convert(::Type{AffineTransform2D{T}},
end

for T in (BigFloat, Float64, Float32, Float16)
@eval (::Type{$T})(A::AffineTransform2D) =
@eval $T(A::AffineTransform2D) =
convert(AffineTransform2D{$T}, A)
end

Expand Down
2 changes: 1 addition & 1 deletion src/interp/flat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

struct FlatLimits{T<:AbstractFloat} <: Limits{T}
len::Int # length of dimension in interpolated array
function (::Type{FlatLimits{T}})(len::Integer) where {T}
function FlatLimits{T}(len::Integer) where {T}
@assert len ≥ 1
new{T}(len)
end
Expand Down
2 changes: 1 addition & 1 deletion src/interp/safeflat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct SafeFlatLimits{T<:AbstractFloat} <: Limits{T}
inf::T # bound for all neighbors before range
sup::T # bound for all neighbors after range
len::Int # length of dimension in interpolated array
function (::Type{SafeFlatLimits{T}})(inf, sup, len::Integer) where {T}
function SafeFlatLimits{T}(inf, sup, len::Integer) where {T}
@assert inf < sup
@assert len ≥ 1
new{T}(inf, sup, len)
Expand Down
8 changes: 4 additions & 4 deletions src/interp/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ struct SparseInterpolator{T<:AbstractFloat,S,N} <: LinearMapping
nrows::Int
ncols::Int
dims::NTuple{N,Int} # dimensions of result
function (::Type{SparseInterpolator{T,S,N}})(C::Vector{T},
J::Vector{Int},
dims::NTuple{N,Int},
ncols::Int) where {T,S,N}
function SparseInterpolator{T,S,N}(C::Vector{T},
J::Vector{Int},
dims::NTuple{N,Int},
ncols::Int) where {T,S,N}
@assert S ≥ 1
@assert minimum(dims) ≥ 1
nrows = prod(dims)
Expand Down
12 changes: 6 additions & 6 deletions src/kernels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ struct CardinalCubicSpline{T,B} <: Kernel{T,4,B}
p::T
q::T

function (::Type{CardinalCubicSpline{T,B}})(c_::Real) where {T,B}
function CardinalCubicSpline{T,B}(c_::Real) where {T,B}
c = convert(T, c_)
new{T,B}(c, (c - 1)/2, (c + 1)/2)
end
Expand Down Expand Up @@ -506,7 +506,7 @@ struct CardinalCubicSpline′{T,B} <: Kernel{T,4,B}
r::T
s::T

function (::Type{CardinalCubicSpline′{T,B}})(c_::Real) where {T,B}
function CardinalCubicSpline′{T,B}(c_::Real) where {T,B}
c = convert(T, c_)
t = 3c + 9
return new{T,B}(c,
Expand Down Expand Up @@ -613,8 +613,8 @@ struct MitchellNetravaliSpline{T,B} <: Kernel{T,4,B}
q1::T
q2::T
q3::T
function (::Type{MitchellNetravaliSpline{T,B}})(b::Real,
c::Real) where {T,B}
function MitchellNetravaliSpline{T,B}(b::Real,
c::Real) where {T,B}
new{T,B}(
b, c,
( 6 - 2*b )/6,
Expand Down Expand Up @@ -707,7 +707,7 @@ struct KeysSpline{T,B} <: Kernel{T,4,B}
q1::T
q2::T
q3::T
function (::Type{KeysSpline{T,B}})(a::Real) where {T,B}
function KeysSpline{T,B}(a::Real) where {T,B}
new{T,B}(a, 1, -a - 3, a + 2, -4*a, 8*a, -5*a, a)
end
end
Expand Down Expand Up @@ -769,7 +769,7 @@ struct LanczosKernel{T,S,B} <: Kernel{T,S,B}
a::T # 1/2 support
b::T # a/pi^2
c::T # pi/a
function (::Type{LanczosKernel{T,S,B}})() where {T,S,B}
function LanczosKernel{T,S,B}() where {T,S,B}
@assert typeof(S) == Int && S > 0 && iseven(S)
a = S/2
new{T,S,B}(a, a/pi^2, pi/a)
Expand Down
16 changes: 8 additions & 8 deletions test/interp-demos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,26 @@ function printtest(prefix::String, count::Integer, tup)
prefix, CPU*elt/count, mem, 1e2*gct/elt)
end

function testdirect!{T,S,B}(dst::Vector{T}, ker::Kernel{T,S,B},
x::AbstractVector{T}, src::Vector{T},
cnt::Integer)
function testdirect!(dst::Vector{T}, ker::Kernel{T,S,B},
x::AbstractVector{T}, src::Vector{T},
cnt::Integer) where {T,S,B}
for k in 1:cnt
apply!(dst, Direct, ker, x, src)
end
return dst
end

function testadjoint!{T,S,B}(dst::Vector{T}, ker::Kernel{T,S,B},
x::AbstractVector{T}, src::Vector{T},
cnt::Integer)
function testadjoint!(dst::Vector{T}, ker::Kernel{T,S,B},
x::AbstractVector{T}, src::Vector{T},
cnt::Integer) where {T,S,B}
for k in 1:cnt
apply!(dst, Adjoint, ker, x, src)
end
return dst
end

function runtests{T<:AbstractFloat}(::Type{T} = Float64,
len::Integer = 1000, cnt::Integer = 100)
function runtests(::Type{T} = Float64,
len::Integer = 1000, cnt::Integer = 100) where T<:AbstractFloat
dim = 500
w = 10
K01 = RectangularSpline(T, Flat)
Expand Down