julia> D1 = Diagonal([1]); D2 = Diagonal([1,2]);
julia> D1 .+ D2
2×2 Diagonal{Int64, Vector{Int64}}:
2 ⋅
⋅ 3
julia> Matrix(D1) .+ D2
2×2 Matrix{Int64}:
2 1
1 3
Ideally, these should produce identical results.
In the structured case, the 1x1 matrix D1 isn't expanded to ones(size(D2)), but instead it's expanded to Diagonal(ones(Int, size(D2,1))). I'm unsure if there's a way to resolve this while preserving type-stability.