-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
MWE:
julia> using BlockArrays, LinearAlgebra
julia> A = mortar(reshape([randn(2, 2), randn(2, 2), randn(2, 2), randn(2, 2)], (2, 2)))
2×2-blocked 4×4 BlockMatrix{Float64}:
-0.915837 -0.333415 │ -0.458008 0.521461
-0.566032 1.29096 │ 0.515333 -0.969364
───────────────────────┼──────────────────────
0.449189 -0.0617162 │ -0.96811 -1.22779
-0.155907 1.19382 │ -2.00874 -0.362436
julia> for ii in axes(A, 1), jj in axes(A, 2)
A[ii, jj] = ifelse( ii == jj, 2.0, 1.0)
end
julia> A
2×2-blocked 4×4 BlockMatrix{Float64}:
2.0 1.0 │ 1.0 1.0
1.0 2.0 │ 1.0 1.0
──────────┼──────────
1.0 1.0 │ 2.0 1.0
1.0 1.0 │ 1.0 2.0
julia> A[diagind(A)] .= -1.0
4-element view(reshape(::BlockedArray{…,::Matrix{Float64}}, 16), 1:5:16) with eltype Float64:
-1.0
-1.0
-1.0
-1.0
julia> A
2×2-blocked 4×4 BlockMatrix{Float64}:
2.0 1.0 │ 1.0 1.0
1.0 2.0 │ 1.0 1.0
──────────┼──────────
1.0 1.0 │ 2.0 1.0
1.0 1.0 │ 1.0 2.0It seems like A should've been modified in these last two steps, or warned me that I was doing something unsupported...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels