Skip to content

Commit

Permalink
support Hermitian
Browse files Browse the repository at this point in the history
  • Loading branch information
putianyi889 committed Mar 16, 2024
1 parent c007b06 commit 4a3dba1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/EltypeExtensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Convert type `S` to have the `eltype` of `T`.
_to_eltype(::Type{T}, ::Type{S}) where {T,S} = eltype(S) == S ? T : MethodError(_to_eltype, T, S)
_to_eltype(::Type{T}, ::Type{Array{S,N}}) where {T,S,N} = Array{T,N}
_to_eltype(::Type{T}, ::Type{<:Set}) where T = Set{T}
for TYP in (Adjoint, Diagonal, Symmetric, SymTridiagonal, Transpose, UpperHessenberg)
for TYP in (Adjoint, Diagonal, Hermitian, Symmetric, SymTridiagonal, Transpose, UpperHessenberg)
@eval _to_eltype(::Type{T}, ::Type{$TYP{S,M}}) where {T,S,M} = $TYP{T,_to_eltype(T,M)}
@eval elconvert(::Type{T}, A::S) where {T,S<:$TYP} = convert(_to_eltype(T, S), A)
end
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ end
testelconvert(Float16, transpose(A))
testelconvert(Float16, SymTridiagonal(Symmetric(A)))
testelconvert(Float16, UpperHessenberg(A))
testelconvert(Float16, Hermitian(A))

r = 1:5
testelconvert(Int8, r)
Expand Down

0 comments on commit 4a3dba1

Please sign in to comment.