m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL))
(dm <- as(m, "dgCMatrix"))# no dimnames for sparse here
(lm <- as(dm, "lgCMatrix"))
str(lm) # no 'x' slot
!lm # no longer sparse
data(KNex)
lmm <- as(KNex $ mm, "lgCMatrix")
xlx <- crossprod(lmm)
image(xlx, main=paste("crossprod(lmm) : Sparse", class(xlx)))
Run the code above in your browser using DataLab