SCM

SCM Repository

[matrix] Diff of /pkg/tests/indexing.R
ViewVC logotype

Diff of /pkg/tests/indexing.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2323, Wed Jan 21 20:50:12 2009 UTC revision 2335, Fri Feb 13 14:09:22 2009 UTC
# Line 587  Line 587 
587    
588  cc <- capture.output(show(dLrg))# show(<diag>) used to error for large n  cc <- capture.output(show(dLrg))# show(<diag>) used to error for large n
589    
590    ## Large Matrix indexing / subassignment
591    ## ------------------------------------- (from ex. by Imran Rashid)
592    n <- 700000
593    m <-  10000
594    nnz <- 20000
595    
596    set.seed(12)
597    f <- sparseMatrix(i = sample(n, size=nnz, replace=TRUE),
598                      j = sample(m, size=nnz, replace=TRUE))
599    str(f)
600    str(thisCol <-  f[,5000])# logi [....]
601    f[,5762] <- thisCol # no fine
602    
603    fx <- sparseMatrix(i = sample(n, size=nnz, replace=TRUE),
604                       j = sample(m, size=nnz, replace=TRUE),
605                       x = round(10*rnorm(nnz)))
606    class(fx)## dgCMatrix
607    fx[,6000] <- (tC <- rep(thisCol, length=nrow(fx)))
608    thCol <- fx[,2000]
609    fx[,5762] <- thCol
610    stopifnot(is(f, "ngCMatrix"), is(fx, "dgCMatrix"),
611              identical(thisCol, f[,5762]),# perfect
612              identical(as.logical(fx[,6000]), tC),
613              identical(thCol,  fx[,5762]))
614    
615  cat('Time elapsed: ', (.pt <- proc.time()),'\n') # "stats"  cat('Time elapsed: ', (.pt <- proc.time()),'\n') # "stats"
616  ##  ##
617  cat("checkMatrix() of all: \n---------\n")  cat("checkMatrix() of all: \n---------\n")

Legend:
Removed from v.2323  
changed lines
  Added in v.2335

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