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 1598, Fri Sep 29 09:39:34 2006 UTC revision 1599, Fri Sep 29 09:39:50 2006 UTC
# Line 44  Line 44 
44  m[, 1] <- -1  m[, 1] <- -1
45  m[1:3,]  m[1:3,]
46    
47    ## testing operations on logical Matrices rather more than indexing:
48  g10 <- m [ m > 10 ]  g10 <- m [ m > 10 ]
49  stopifnot(18 == length(g10))  stopifnot(18 == length(g10))
50  stopifnot(10 == length(m[ m <= 10 ]))  stopifnot(10 == length(m[ m <= 10 ]))
51  sel <- (20 < m) & (m < 150)  sel <- (20 < m) & (m < 150)
52    nsel <-(20 >= m) | (m >= 150)
53  (ssel <- as(sel, "sparseMatrix"))  (ssel <- as(sel, "sparseMatrix"))
54  stopifnot(is(sel, "lMatrix"), is(ssel, "lsparseMatrix"),  stopifnot(is(sel, "lMatrix"), is(ssel, "lsparseMatrix"),
55            identical(  m[ ssel], as.matrix(m)[as.matrix( ssel)]),            identical3(!sel, !ssel, nsel), # !<sparse> is typically dense
56            identical(  m[!ssel], as.matrix(m)[as.matrix(!ssel)])            identical3(m[ sel],  m[ ssel], as.matrix(m)[as.matrix( ssel)]),
57              identical3(m[!sel],  m[!ssel], as.matrix(m)[as.matrix(!ssel)])
58            )            )
59    
60  ## more sparse Matrices --------------------------------------  ## more sparse Matrices --------------------------------------

Legend:
Removed from v.1598  
changed lines
  Added in v.1599

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