You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more about getting edge cases working so that there are no surprises when writing generic code. The specific example presented above may not mean much
Fix#48664
After this, broadcasting over structured block matrices with
matrix-valued elements works:
```julia
julia> D = Diagonal([[1 2; 3 4], [5 6; 7 8]])
2×2 Diagonal{Matrix{Int64}, Vector{Matrix{Int64}}}:
[1 2; 3 4] ⋅
⋅ [5 6; 7 8]
julia> D .+ D
2×2 Diagonal{Matrix{Int64}, Vector{Matrix{Int64}}}:
[2 4; 6 8] ⋅
⋅ [10 12; 14 16]
julia> cos.(D)
2×2 Matrix{Matrix{Float64}}:
[0.855423 -0.110876; -0.166315 0.689109] [1.0 0.0; 0.0 1.0]
[1.0 0.0; 0.0 1.0] [0.928384 -0.069963; -0.0816235 0.893403]
```
Such operations show up when using `BlockArrays`.
The implementation is a bit hacky as it uses `0I` as the zero element in
`fzero`, which isn't really the correct zero if the blocks are
rectangular. Nonetheless, this works, as `fzero` is only used to
determine if the structure is preserved.
For block-banded structured matrix types, the zero elements may not be well-defined, e.g:
However, in this case, the result may be obtained without any reference to the zeros.
I wonder if it might be possible to evaluate the result using broadcasting without explicitly evaluating the zero elements?
The text was updated successfully, but these errors were encountered: