julia
b4052a5f - Forward `axes` to the parent for a `Diagonal` (#50514)

Commit
2 years ago
Forward `axes` to the parent for a `Diagonal` (#50514) Given that [quite a few](https://juliahub.com/ui/Search?q=axes%5Ba-zA-Z%5C%28%5C%29%3A%5D%2BDiagonal&type=code&r=true) packages define `axes(d::Diagonal{T, CustomVector{T}})` as `ax = parent(d); (ax,ax)`, perhaps it makes sense to have this defined in `LinearAlgebra`. After this, ```julia julia> using StaticArrays, StructArrays, LinearAlgebra julia> D = Diagonal(StructArray{Complex{Int}}((SA[1,2], SA[1,2]))) 2×2 Diagonal{Complex{Int64}, StructVector{Complex{Int64}, @NamedTuple{re::SVector{2, Int64}, im::SVector{2, Int64}}, Int64}} with indices SOneTo(2)×SOneTo(2): 1+1im ⋅ ⋅ 2+2im julia> axes(D) (SOneTo(2), SOneTo(2)) ``` The static sizes are preserved. --------- Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>
Author
Parents
Loading