Skip to content

Commit

Permalink
Don't specialize similar for Hankel (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Jan 10, 2024
1 parent 465d37a commit 02f06e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/hankel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Base.@propagate_inbounds function getindex(A::Hankel, i::Integer, j::Integer)
return A.v[i+j-1]
end
AbstractMatrix{T}(A::Hankel) where {T} = Hankel{T}(AbstractVector{T}(A.v), A.size)
for fun in (:zero, :conj, :copy, :-, :similar, :real, :imag)
for fun in (:zero, :conj, :copy, :-, :real, :imag)
@eval $fun(A::Hankel) = Hankel($fun(A.v), size(A))
end
for op in (:+, :-)
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ end
@test_throws ArgumentError Hankel(Int[], (3,4))
@test_throws ArgumentError Hankel(1:5, (3,4))
end

@testset "similar" begin
H = Hankel(1:4)
M = copyto!(similar(H), H)
@test triu(M) == triu(Matrix(H))
end
end

@testset "Convert" begin
Expand Down

0 comments on commit 02f06e5

Please sign in to comment.