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 2266, Wed Sep 17 11:52:59 2008 UTC revision 2267, Wed Sep 17 11:55:57 2008 UTC
# Line 496  Line 496 
496  d6[cbind(ii,ii)] <- 7*ii  d6[cbind(ii,ii)] <- 7*ii
497  stopifnot(is(d6, "ddiMatrix"), identical(d6, Diagonal(x=c(7*1:2,1,7*4:5,1))))  stopifnot(is(d6, "ddiMatrix"), identical(d6, Diagonal(x=c(7*1:2,1,7*4:5,1))))
498    
499    for(j in 3:6) { ## even and odd j used to behave differently
500        M <- Matrix(0, j,j); m <- matrix(0, j,j)
501        T  <- as(M, "TsparseMatrix")
502        TG <- as(T, "generalMatrix")
503        G <-  as(M, "generalMatrix")
504        id <- cbind(1:j,1:j)
505        i2 <- cbind(1:j,j:1)
506        m[id] <- 1:j
507        M[id] <- 1:j ; stopifnot(is(M,"symmetricMatrix"))
508        T[id] <- 1:j ; stopifnot(is(T,"symmetricMatrix"))
509        G[id] <- 1:j
510        TG[id]<- 1:j
511        m[i2] <- 10
512        M[i2] <- 10 ; stopifnot(is(M,"symmetricMatrix"))
513        T[i2] <- 10 ; stopifnot(is(T,"symmetricMatrix"))
514        G[i2] <- 10
515        TG[i2]<- 10
516        ##
517        assert.EQ.mat(M, m)
518        assert.EQ.mat(T, m)
519        assert.EQ.mat(G, m)
520        assert.EQ.mat(TG,m)
521    }
522    
523    
524    ## drop, triangular, ...
525  (M3 <- Matrix(upper.tri(matrix(, 3, 3)))) # ltC; indexing used to fail  (M3 <- Matrix(upper.tri(matrix(, 3, 3)))) # ltC; indexing used to fail
526  T3 <- as(M3, "TsparseMatrix")  T3 <- as(M3, "TsparseMatrix")
527  stopifnot(identical(drop(M3), M3),  stopifnot(identical(drop(M3), M3),

Legend:
Removed from v.2266  
changed lines
  Added in v.2267

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