SCM

SCM Repository

[matrix] View of /pkg/tests/mm-redo.R
ViewVC logotype

View of /pkg/tests/mm-redo.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 538 - (download) (annotate)
Thu Feb 10 13:50:27 2005 UTC (14 years, 6 months ago) by maechler
File size: 643 byte(s)
add @Dimnames (-> new "mm")
library(Matrix)

mmT <- as(mm, "dgTMatrix")
str(mmT)
mm3 <- cbind(i = mmT@i, j = mmT@j, x = mmT@x)
write.table(mm3, file = "mm-Matrix.tab", row.names=FALSE)# -> ASCII version

str(mmr <- read.table("mm-Matrix.tab", header = TRUE))
mmr$i <- as.integer(mmr$i)
mmr$j <- as.integer(mmr$j)

mmN <- with(mmr, new("dgTMatrix", Dim = c(max(i)+1:1,max(j)+1:1),
                     i = i, j = j, x = x))

stopifnot(identical(mmT, mmN)) # !!
## weaker (and hence TRUE too):
stopifnot(all.equal(as(mmN, "matrix"),
                    as(mmT, "matrix"), tol=0))

mm <- as(mmN, "dgCMatrix")
## save(mm, file = "....../Matrix/data/mm.rda", compress = TRUE)

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge