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 1798, Sat Mar 24 14:52:47 2007 UTC revision 1799, Sat Mar 24 14:54:00 2007 UTC
# Line 81  Line 81 
81  mC[1:2,]  mC[1:2,]
82  mC[7,  drop = FALSE]  mC[7,  drop = FALSE]
83  assert.EQ.mat(mC[1:2,], mm[1:2,])  assert.EQ.mat(mC[1:2,], mm[1:2,])
84    
85    ## *repeated* indices - did not work at all ...
86    i <- rep(8:10,2)
87    j <- c(2:4, 4:3)
88    assert.EQ.mat(mC[i,], mm[i,])
89    assert.EQ.mat(mC[,j], mm[,j])
90    if(FALSE) ## FIXME
91    assert.EQ.mat(mC[i,j], mm[i,j])
92    
93  stopifnot(all.equal(mC[,3], mm[,3]),  stopifnot(all.equal(mC[,3], mm[,3]),
94            identical(mC[ij], mm[ij]))            identical(mC[ij], mm[ij]))
95  assert.EQ.mat(mC[7, , drop=FALSE], mm[7, , drop=FALSE])  assert.EQ.mat(mC[7, , drop=FALSE], mm[7, , drop=FALSE])
# Line 142  Line 151 
151  m0 <- Diagonal(5)  m0 <- Diagonal(5)
152  (m1 <- as(m0, "sparseMatrix"))  # dtTMatrix  (m1 <- as(m0, "sparseMatrix"))  # dtTMatrix
153  (m2 <- as(m0, "CsparseMatrix")) # dtCMatrix (with an irrelevant warning)  (m2 <- as(m0, "CsparseMatrix")) # dtCMatrix (with an irrelevant warning)
154    m1g <- as(m1, "generalMatrix")
155    stopifnot(is(m1g, "dgTMatrix"))
156    assert.EQ.mat(m2[1:3,],    diag(5)[1:3,])
157    assert.EQ.mat(m2[,c(4,1)], diag(5)[,c(4,1)])
158    stopifnot(identical(m2[1:3,], as(m1[1:3,], "CsparseMatrix")),
159              identical(Matrix:::uniqTsparse(m1[, c(4,2)]),
160                        Matrix:::uniqTsparse(as(m2[, c(4,2)], "TsparseMatrix")))
161              )## failed in 0.9975-11
162    
163  M <- m0; M[1,] <- 0  M <- m0; M[1,] <- 0
164  stopifnot(identical(M, Diagonal(x=c(0, rep(1,4)))))  stopifnot(identical(M, Diagonal(x=c(0, rep(1,4)))))

Legend:
Removed from v.1798  
changed lines
  Added in v.1799

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