# SCM Repository

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

# Diff of /pkg/tests/indexing.R

revision 2119, Tue Mar 4 21:44:04 2008 UTC revision 2120, Tue Mar 4 21:44:41 2008 UTC
# Line 212  Line 212
212            all(sm[,-(1:3)] == 0)            all(sm[,-(1:3)] == 0)
213            )            )
214
### Diagonal -- Sparse:
215  m0 <- Diagonal(5)  m0 <- Diagonal(5)
216    stopifnot(identical(m0[2,], m0[,2]),
217              identical(m0[,1], c(1,0,0,0,0)))
218    ### Diagonal -- Sparse:
219  (m1 <- as(m0, "sparseMatrix"))  # dtTMatrix  (m1 <- as(m0, "sparseMatrix"))  # dtTMatrix
220  (m2 <- as(m0, "CsparseMatrix")) # dtCMatrix (with an irrelevant warning)  (m2 <- as(m0, "CsparseMatrix")) # dtCMatrix (with an irrelevant warning)
221  m1g <- as(m1, "generalMatrix")  m1g <- as(m1, "generalMatrix")
# Line 225  Line 227
227                      Matrix:::uniqTsparse(as(m2[, c(4,2)], "TsparseMatrix")))                      Matrix:::uniqTsparse(as(m2[, c(4,2)], "TsparseMatrix")))
228            )## failed in 0.9975-11            )## failed in 0.9975-11
229
230    (uTr <- new("dtTMatrix", Dim = c(3L,3L), diag="U"))
231    uTr[1,] <- 0
232    assert.EQ.mat(uTr, cbind(0, rbind(0,diag(2))))
233
234  M <- m0; M[1,] <- 0  M <- m0; M[1,] <- 0
235  stopifnot(identical(M, Diagonal(x=c(0, rep(1,4)))))  stopifnot(identical(M, Diagonal(x=c(0, rep(1,4)))))
236  M <- m0; M[,3] <- 3 ; M ; stopifnot(is(M, "sparseMatrix"), M[,3] == 3)  M <- m0; M[,3] <- 3 ; M ; stopifnot(is(M, "sparseMatrix"), M[,3] == 3)

Legend:
 Removed from v.2119 changed lines Added in v.2120