arrays - How to create a customized matrix in R where first few columns are zero and rest are an Identity Matrix? -
suppose have matrix a
of order k2*k
k=k1+k2
such k1=k-k2
. characteristic of matrix a
such first k1
columns 0 , remaining k2*k2
identity matrix. how create such customized matrix in r?
note:
for smaller dimensions of k1
, k2
, it's easy. looking automated command handling larger dimensions of k1
, k2
.
k <- 20 k2 <- 15 k1 <- k - k2 diagonal <- diag(k2) zeros <- matrix(0, nrow = k2, ncol = k1) result <- cbind(zeros, diagonal)
Comments
Post a Comment