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 2496, Sat Nov 14 17:24:42 2009 UTC revision 2505, Wed Dec 9 17:33:23 2009 UTC
# Line 129  Line 129 
129  assert.EQ.mat(ds[NA,NA], ss[NA,NA])  assert.EQ.mat(ds[NA,NA], ss[NA,NA])
130  assert.EQ.mat(ds[NA,  ], ss[NA,])  assert.EQ.mat(ds[NA,  ], ss[NA,])
131  assert.EQ.mat(ds[  ,NA], ss[,NA])  assert.EQ.mat(ds[  ,NA], ss[,NA])
 stopifnot(identical(ds[2 ,NA], ss[2,NA]),  
           identical(ds[NA, 1], ss[NA, 1]))  
132  T <- as(S, "TsparseMatrix")  T <- as(S, "TsparseMatrix")
133    stopifnot(identical(ds[2 ,NA], ss[2,NA]),
134              identical(ds[NA, 1], ss[NA, 1]),
135              identical(S, as(T, "CsparseMatrix")) )
136    
137  ## non-repeated indices:  ## non-repeated indices:
138  i <- c(7:5, 2:4);assert.EQ.mat(T[i,i], ss[i,i])  i <- c(7:5, 2:4);assert.EQ.mat(T[i,i], ss[i,i])
139  ## NA in indices  -- check that we get a helpful error message:  ## NA in indices  -- check that we get a helpful error message:
# Line 272  Line 274 
274  M <- m0; M[1:3, 3] <- 0 ;M  M <- m0; M[1:3, 3] <- 0 ;M
275  T <- m0; T[1:3, 3] <- 10  T <- m0; T[1:3, 3] <- 10
276  stopifnot(identical(M, Diagonal(x=c(1,1, 0, 1,1))),  stopifnot(identical(M, Diagonal(x=c(1,1, 0, 1,1))),
277            is(T, "triangularMatrix"), identical(T[,3], c(10,10,10,0,0)))            isValid(T, "triangularMatrix"), identical(T[,3], c(10,10,10,0,0)))
278    
279  M <- m1; M[1,] <- 0 ; M ; assert.EQ.mat(M, diag(c(0,rep(1,4))), tol=0)  M <- m1; M[1,] <- 0 ; M ; assert.EQ.mat(M, diag(c(0,rep(1,4))), tol=0)
280  M <- m1; M[,3] <- 3 ; stopifnot(is(M,"sparseMatrix"), M[,3] == 3)  M <- m1; M[,3] <- 3 ; stopifnot(is(M,"sparseMatrix"), M[,3] == 3)
# Line 280  Line 282 
282  M <- m1; M[1:3, 3] <- 0 ;M  M <- m1; M[1:3, 3] <- 0 ;M
283  assert.EQ.mat(M, diag(c(1,1, 0, 1,1)), tol=0)  assert.EQ.mat(M, diag(c(1,1, 0, 1,1)), tol=0)
284  T <- m1; T[1:3, 3] <- 10; checkMatrix(T)  T <- m1; T[1:3, 3] <- 10; checkMatrix(T)
285  stopifnot(is(T, "dtTMatrix"), identical(T[,3], c(10,10,10,0,0)))  stopifnot(isValid(T, "dtTMatrix"), identical(T[,3], c(10,10,10,0,0)))
286    
287  M <- m2; M[1,] <- 0 ; M ; assert.EQ.mat(M, diag(c(0,rep(1,4))), tol=0)  M <- m2; M[1,] <- 0 ; M ; assert.EQ.mat(M, diag(c(0,rep(1,4))), tol=0)
288  M <- m2; M[,3] <- 3 ; stopifnot(is(M,"sparseMatrix"), M[,3] == 3)  M <- m2; M[,3] <- 3 ; stopifnot(is(M,"sparseMatrix"), M[,3] == 3)

Legend:
Removed from v.2496  
changed lines
  Added in v.2505

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