Maybe this is unnecessary, or maybe there is an easy way to do this already, but could it be beneficial to add functionality like this?
julia> x = rand(2,2)
2×2 Matrix{Float64}:
0.378402 0.484365
0.799401 0.019679
julia> x_diag = BlockDiagonal(x, 2)
4×4 BlockDiagonal{Float64, Matrix{Float64}}:
0.378402 0.484365 0.0 0.0
0.799401 0.019679 0.0 0.0
0.0 0.0 0.378402 0.484365
0.0 0.0 0.799401 0.019679
julia> BlockDiagonal(x, 2) == BlockDiagonal([x, x])
true
So far the best way to do this at this point I have found is this:
julia> BlockDiagonal(FillArrays.fill(x,2))
4×4 BlockDiagonal{Float64, Matrix{Float64}}:
0.378402 0.484365 0.0 0.0
0.799401 0.019679 0.0 0.0
0.0 0.0 0.378402 0.484365
0.0 0.0 0.799401 0.019679
Maybe this is unnecessary, or maybe there is an easy way to do this already, but could it be beneficial to add functionality like this?
So far the best way to do this at this point I have found is this: