Skip to content

Commit

Permalink
Fix deprecate syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Aug 15, 2018
1 parent d7a76d6 commit 2926171
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/ToeplitzMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ Hankel{T}(A::AbstractMatrix) where T = Hankel{T}(A[:,1], A[end,:])
Hankel(A::AbstractMatrix) = Hankel(A[:,1], A[end,:])

convert(::Type{Array}, A::Hankel) = convert(Matrix, A)
function convert(::Type{Matrix}, A::Hankel)
convert(::Type{Matrix}, A::Hankel{T}) where T = convert(Matrix{T}, A)
function convert(::Type{Matrix{T}}, A::Hankel) where T
m, n = size(A)
Af = Matrix{T}(undef, m, n)
for j = 1:n
Expand Down Expand Up @@ -635,8 +636,9 @@ getindex(A::Hankel, i::Integer, j::Integer) = A.T[i,end-j+1]


if VERSION v"0.7"
@deprecate Base.full(A::AbstractToeplitz) Matrix(A)
@deprecate Base.full(A::Hankel) Matrix(A)
import Base: full
@deprecate full(A::AbstractToeplitz) Matrix(A)
@deprecate full(A::Hankel) Matrix(A)
end

end #module
12 changes: 6 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ end

Hs = Hankel(0.9.^(ns-1:-1:0), 0.4.^(0:ns-1))
Hl = Hankel(0.9.^(nl-1:-1:0), 0.4.^(0:nl-1))
@test Hs * xs[:,1] full(Hs) * xs[:,1]
@test Hs * xs full(Hs) * xs
@test Hl * xl full(Hl) * xl
@test Hs * xs[:,1] Matrix(Hs) * xs[:,1]
@test Hs * xs Matrix(Hs) * xs
@test Hl * xl Matrix(Hl) * xl
end

@testset "Complex square" begin
Expand All @@ -127,9 +127,9 @@ end
@testset "Complex rectangular" begin
Hs = Hankel(complex(0.9.^(ns-1:-1:0)), complex(0.4.^(0:nl-1)))
Hl = Hankel(complex(0.9.^(nl-1:-1:0)), complex(0.4.^(0:ns-1)))
@test Hs * xl[:,1] full(Hs) * xl[:,1]
@test Hs * xl full(Hs) * xl
@test Hl * xs full(Hl) * xs
@test Hs * xl[:,1] Matrix(Hs) * xl[:,1]
@test Hs * xl Matrix(Hs) * xl
@test Hl * xs Matrix(Hl) * xs
end

@testset "Convert" begin
Expand Down

0 comments on commit 2926171

Please sign in to comment.