# SCM Repository

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

# Diff of /pkg/tests/indexing.R

revision 1655, Mon Oct 30 17:16:27 2006 UTC revision 1665, Fri Nov 3 23:18:07 2006 UTC
# Line 96  Line 96
96            identical3(mm[3,], mC[3,], mT[3,]),            identical3(mm[3,], mC[3,], mT[3,]),
97            identical3(mT[2,3], mC[2,3], 0),            identical3(mT[2,3], mC[2,3], 0),
98            identical(mT[], mT),            identical(mT[], mT),
99            ## TODO: identical4() with  m[c(3,7), 2:4] - fail because of 'dimnames'            identical4(       mm[c(3,7), 2:4],  as.mat( m[c(3,7), 2:4]),
100            ## TODO: identical3() with as(mC[c(3,7), 2:4],"matrix"),                       as.mat(mT[c(3,7), 2:4]), as.mat(mC[c(3,7), 2:4]))
##       fails because of 'dimnames'
identical(mm[c(3,7), 2:4], as(mT[c(3,7), 2:4],"matrix"))
101            )            )
102
103  x.x <- crossprod(mC)  x.x <- crossprod(mC)
# Line 109  Line 107
107  tail(x.x., -3) # all but the first three lines  tail(x.x., -3) # all but the first three lines
108
109  lx.x <- as(x.x, "lsCMatrix") # FALSE only for "structural" 0  lx.x <- as(x.x, "lsCMatrix") # FALSE only for "structural" 0
110  if(FALSE) { ## FIXME: needs coercion  "lsCMatrix" to "lgTMatrix"  (l10 <- lx.x[1:10, 1:10])# "lsC"
111      lx.x[1:10, 1:10]  (l3 <-  lx.x[1:3, ])
112      lx.x[1:3, ]  m.x <- as(x.x, "matrix")
113  }  stopifnot(class(l10) == "lsCMatrix", # symmetric indexing -> symmetric !
114              identical(as.mat(lx.x), m.x != 0),
115              identical(as.logical(lx.x), as.logical(m.x)),
116              identical(as.mat(l10), m.x[1:10, 1:10] != 0),
117              identical(as.mat(l3 ), m.x[1:3, ] != 0)
118              )
119
120
121  ## --- negative indices ----------  ## --- negative indices ----------
122  mc <- mC[1:5, 1:7]  mc <- mC[1:5, 1:7]

Legend:
 Removed from v.1655 changed lines Added in v.1665