Skip to content

Commit

Permalink
Update LinearAlgebra.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Nov 27, 2023
1 parent edef442 commit a3dae80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/implementations/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ function similar_array_type(
::Type{LinearAlgebra.Diagonal{T,VT}},
::Type{S},
) where {S,T,VT<:AbstractVector{T}}
return LinearAlgebra.Diagonal{S,Vector{S}}
return LinearAlgebra.Diagonal{S,similar_array_type(VT, S)}
end

similar_array_type(::Type{<:AbstractVector}, ::Type{T}} = Vector{T}

similar_array_type(::Type{Array{T,N}}, ::Type{S}) where {S,T,N} = Array{S,N}

similar_array_type(::Type{BitArray{N}}, ::Type{S}) where {S,N} = Array{S,N}
Expand Down

0 comments on commit a3dae80

Please sign in to comment.