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 1374, Tue Aug 15 18:17:44 2006 UTC revision 1575, Mon Sep 18 14:47:40 2006 UTC
# Line 46  Line 46 
46    
47  g10 <- m [ m > 10 ]  g10 <- m [ m > 10 ]
48  stopifnot(18 == length(g10))  stopifnot(18 == length(g10))
 ## needs R >= 2.3.0 [Buglet in R(<= 2.2.1)'s possibleExtends()]:  
49  stopifnot(10 == length(m[ m <= 10 ]))  stopifnot(10 == length(m[ m <= 10 ]))
50    sel <- (20 < m) & (m < 150)
51    (ssel <- as(sel, "sparseMatrix"))
52    stopifnot(is(sel, "lMatrix"), is(ssel, "lsparseMatrix"),
53              identical(  m[ ssel], as.matrix(m)[as.matrix( ssel)]),
54              identical(  m[!ssel], as.matrix(m)[as.matrix(!ssel)])
55              )
56    
57    ## more sparse Matrices --------------------------------------
 ### Sparse Matrices --------------------------------------  
58    
59  m <- 1:800  m <- 1:800
60  set.seed(101) ; m[sample(800, 600)] <- 0  set.seed(101) ; m[sample(800, 600)] <- 0
# Line 96  Line 100 
100  stopifnot(class(x.x) == "dsCMatrix",  stopifnot(class(x.x) == "dsCMatrix",
101            class(x.x. <- round(x.x / 10000)) == "dsCMatrix")            class(x.x. <- round(x.x / 10000)) == "dsCMatrix")
102  head(x.x.) # Note the *non*-structural 0's printed as "0"  head(x.x.) # Note the *non*-structural 0's printed as "0"
103  ## FIXME (once we require 2.4.x or higher):  tail(x.x., -3) # all but the first three lines
 ##  tail(x.x., -2) # the last two lines  
104    
105  lx.x <- as(x.x, "lsCMatrix") # FALSE only for "structural" 0  lx.x <- as(x.x, "lsCMatrix") # FALSE only for "structural" 0
106  if(FALSE) { ## FIXME: needs coercion  "lsCMatrix" to "lgTMatrix"  if(FALSE) { ## FIXME: needs coercion  "lsCMatrix" to "lgTMatrix"

Legend:
Removed from v.1374  
changed lines
  Added in v.1575

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