M <- sparse3Darray(i=1:4, j=sample(1:4, replace=TRUE),
k=c(1,2,1,2), x=1:4, dims=c(5,5,2))
negM <- -M
twoM <- M + M
Mplus <- M + 1 ## not sparse!
posM <- (M > 0)
range(M)
sinM <- sin(M)
cosM <- cos(M) ## not sparse!
expM1 <- expm1(M)
Run the code above in your browser using DataLab