Is there a function in Julia to return(extract) the sub-matrices (or their indexes) from Block Diagonal Matrix similar to here Extract matrices from a Block Diagonal Matrix??
For example, I need to return A[1:3,1:3]
, A[4:5,4:5]
, and `A[6:end,6:end] i.e., or indexes of (3,3) and (5,5).
julia> A = sparse([5.0 1 2 0 0 0 0; 2 1 5 0 0 0 0; 5 6 7 0 0 0 0; 0 0 0 2 -1 0 0; 0 0 0 5 6 0 0; 0 0 0 0 0 10 11; 0 0 0 0 0 2 3])
7Γ7 SparseMatrixCSC{Float64, Int64} with 17 stored entries:
5.0 1.0 2.0 β
β
β
β
2.0 1.0 5.0 β
β
β
β
5.0 6.0 7.0 β
β
β
β
β
β
β
2.0 -1.0 β
β
β
β
β
5.0 6.0 β
β
β
β
β
β
β
10.0 11.0
β
β
β
β
β
2.0 3.0