SCM

SCM Repository

[matrix] View of /branches/Matrix-mer2/tests/base-matrix-fun.R
ViewVC logotype

View of /branches/Matrix-mer2/tests/base-matrix-fun.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 996 - (download) (annotate)
Sat Oct 29 13:53:28 2005 UTC (14 years, 1 month ago) by bates
File size: 1024 byte(s)
Merge changes in revision 1936 of trunk
#### Thanks to the manipulation in base namespace, see  ../R/zzz.R ,
#### all the functions (in 'base' or namespaces that import it)
#### starting with something like
####	" x <- as.matrix(x) "  or   " X <- as.array(X) "
#### will work for 'Matrix'-matrices

library(Matrix)

str(m1 <- mm[1:500, 1:200])
m11 <- m1[1:100, 1:20]
## These now work thanks to using our as.matrix():
str(D1 <- dist(m11))
str(rs <- apply(m1, 1, sum))

stopifnot(identical(kappa(Matrix(2:5, 2)),
                    kappa(matrix(2:5, 2))))
## used to seg.fault, PR#7984,
## because qr() was calling the wrong as.matrix()

## also matplot() or pairs().

### outer() works thanks to  as.array() :
## Doesn't work in R-2.3.0 because the definition of outer has changed
##m <- Matrix(0:5, 3, 2)
##(m2 <- Matrix(diag(c(3,1))))
##(m3 <- crossprod(t(m)))
##stopifnot(identical(outer(m, m2),
##                    outer(as(m,"matrix"), as(m2,"matrix"))),
##          identical(outer(m3, m2),
##                    outer(as(m3,"matrix"), as(m2,"matrix"))))

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