# SCM Repository

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

# Diff of /pkg/tests/indexing.R

revision 2506, Fri Dec 11 12:54:28 2009 UTC revision 2508, Thu Dec 24 09:47:57 2009 UTC
# Line 145  Line 145
145  set.seed(11)  set.seed(11)
146  for(n in 1:50) {  for(n in 1:50) {
147      i <- sample(N, max(2, sample(N,1)), replace = FALSE)      i <- sample(N, max(2, sample(N,1)), replace = FALSE)
148      validObject(Tii <- T[i,i])      validObject(Tii <- T[i,i]) ; tTi <- t(T)[i,i]
149      stopifnot(is(Tii, "dsTMatrix"), # remained symmetric Tsparse      stopifnot(is(Tii, "dsTMatrix"), # remained symmetric Tsparse
150                identical(t(Tii), t(T)[i,i]))                is(tTi, "dsTMatrix"), # may not be identical when *sorted* differently
151                  identical(as(t(Tii),"CsparseMatrix"), as(tTi,"CsparseMatrix")))
152      assert.EQ.mat(Tii, ss[i,i])      assert.EQ.mat(Tii, ss[i,i])
153  }  }
154
# Line 201  Line 202
202  validObject(print(mT[,c(2,4)]))  validObject(print(mT[,c(2,4)]))
203  stopifnot(all.equal(mT[2,], mm[2,]),  stopifnot(all.equal(mT[2,], mm[2,]),
204            ## row or column indexing in combination with t() :            ## row or column indexing in combination with t() :
205            identical(mT[2,], t(mT)[,2]),            Q.C.identical(mT[2,], t(mT)[,2]),
206            identical(mT[-2,], t(t(mT)[,-2])),            Q.C.identical(mT[-2,], t(t(mT)[,-2])),
207            identical(mT[c(2,5),], t(t(mT)[,c(2,5)]))            Q.C.identical(mT[c(2,5),], t(t(mT)[,c(2,5)])) )
)
208  assert.EQ.mat(mT[4,, drop = FALSE], mm[4,, drop = FALSE])  assert.EQ.mat(mT[4,, drop = FALSE], mm[4,, drop = FALSE])
209  stopifnot(identical3(mm[,1], mC[,1], mT[,1]),  stopifnot(identical3(mm[,1], mC[,1], mT[,1]),
210            identical3(mm[3,], mC[3,], mT[3,]),            identical3(mm[3,], mC[3,], mT[3,]),

Legend:
 Removed from v.2506 changed lines Added in v.2508