x <- unvec_mat(
cbind(seq(3), seq(2,4), seq(3,5)),
matrix(c(rep(TRUE, 3), FALSE), ncol=2),
0
)
y <- array(c(1,2,3,0,2,3,4,0,3,4,5,0), dim=c(2,2,3))
stopifnot(identical(x[[1]], y[,,1]))
stopifnot(identical(x[[2]], y[,,2]))
stopifnot(identical(x[[3]], y[,,3]))
Run the code above in your browser using DataLab