From 6ced28c290164a702b2ad966104b9565ffb1ca1c Mon Sep 17 00:00:00 2001 From: "femtocleaner[bot]" Date: Wed, 26 Sep 2018 18:03:07 +0000 Subject: [PATCH] Fix deprecations --- src/AffineTransforms.jl | 8 ++++---- src/interp/flat.jl | 2 +- src/interp/safeflat.jl | 2 +- src/interp/sparse.jl | 8 ++++---- src/kernels.jl | 12 ++++++------ test/interp-demos.jl | 16 ++++++++-------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/AffineTransforms.jl b/src/AffineTransforms.jl index 75ffeb0..7e26dc5 100644 --- a/src/AffineTransforms.jl +++ b/src/AffineTransforms.jl @@ -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 @@ -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 diff --git a/src/interp/flat.jl b/src/interp/flat.jl index 35c81fb..83ace7e 100644 --- a/src/interp/flat.jl +++ b/src/interp/flat.jl @@ -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 diff --git a/src/interp/safeflat.jl b/src/interp/safeflat.jl index 5e60698..a760f6f 100644 --- a/src/interp/safeflat.jl +++ b/src/interp/safeflat.jl @@ -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) diff --git a/src/interp/sparse.jl b/src/interp/sparse.jl index 9f206b2..ed22b4b 100644 --- a/src/interp/sparse.jl +++ b/src/interp/sparse.jl @@ -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) diff --git a/src/kernels.jl b/src/kernels.jl index 9832d26..3e18155 100644 --- a/src/kernels.jl +++ b/src/kernels.jl @@ -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 @@ -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, @@ -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, @@ -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 @@ -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) diff --git a/test/interp-demos.jl b/test/interp-demos.jl index 542be15..854cfa6 100644 --- a/test/interp-demos.jl +++ b/test/interp-demos.jl @@ -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)