List of combination between rows of diagonal block matrix
问题 I have the following R matrix that is a combination of 2x3 and 3x3 submatrices and it can be more than 2 submatrices with different dimension (e.g. m1xp and m2xp and m3xp where each of m1,m2,m3 <= p) A2 <- list(rbind(c(1,1,1),c(-1,1,-1)), rbind(c(-1,1,1),c(1,-1,2),c(2,-1,2))) library(Matrix) A2 <- as.matrix(Matrix::bdiag(A2)) Rhs <- matrix(c(0,5,0.5,4),nrow = 4) beta <- c(rep(1.2,3),c(0.5,0.2,0.1)) > A2 [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 1 1 0 0 0 [2,] -1 1 -1 0 0 0 [3,] 0 0 0 -1 1 1 [4,] 0