Running ‘Class+Meth.R’
  Running ‘Simple.R’
  Running ‘abIndex-tsts.R’
  Running ‘base-matrix-fun.R’
  Running ‘bind.R’
  Comparing ‘bind.Rout’ to ‘bind.Rout.save’ ... OK
  Running ‘dg_Matrix.R’
  Running ‘dpo-test.R’
  Running ‘dtpMatrix.R’
  Running ‘factorizing.R’ [22s/27s]
  Running ‘group-methods.R’
  Running ‘indexing.R’ [21s/24s]
  Comparing ‘indexing.Rout’ to ‘indexing.Rout.save’ ... OK
  Running ‘matprod.R’ [12s/13s]
  Running ‘matr-exp.R’
  Running ‘other-pkgs.R’
  Running ‘packed-unpacked.R’
  Running ‘spModel.matrix.R’
  Running ‘symmDN.R’
  Running ‘validObj.R’
  Running ‘write-read.R’
Running the tests in ‘tests/Simple.R’ failed.
Complete output:
  > #### Currently a collection of simple tests
  > ##	(since 'Matrix' takes long to load, rather have fewer source files!)
  > 
  > ##-------- *BEFORE* attaching Matrix: --------------------------------
  > str(Matrix::Matrix)# -> load the namespace
  function (data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL, 
      sparse = NULL, doDiag = TRUE, forceCheck = FALSE)  
  > T <- new("ngTMatrix", i=0L, j=2L, Dim = c(2L,6L))
  > T
  2 x 6 sparse Matrix of class "ngTMatrix"
                  
  [1,] . . | . . .
  [2,] . . . . . .
  > as(T, "CsparseMatrix")
  2 x 6 sparse Matrix of class "ngCMatrix"
                  
  [1,] . . | . . .
  [2,] . . . . . .
  > ## gave Error in asMethod(object) : could not find function ".M.classEnv"
  > ## from  0.999375-23 to *-25
  > 
  > ## another even shorter version of this:
  > n <- new("dgCMatrix")
  > n
  0 x 0 sparse Matrix of class "dgCMatrix"
  <0 x 0 matrix>
  > ## this:
  > m <- Matrix::Matrix(cbind(1,0,diag(x=2:4)))
  > m
  3 x 5 sparse Matrix of class "dgCMatrix"
                
  [1,] 1 . 2 . .
  [2,] 1 . . 3 .
  [3,] 1 . . . 4
  > mt <- m + table(gl(3,5), gl(5,3))# failed in Matrix <= 1.2.9
  > mt
  3 x 5 sparse Matrix of class "dgCMatrix"
     
      1 2 3 4 5
    1 4 2 2 . .
    2 1 1 3 4 .
    3 1 . . 2 7
  > stopifnot(is(mt, "sparseMatrix"))
  > 
  > ##--------------------------------------------------------------------
  > 
  > library(Matrix)
  > 
  > source(system.file("test-tools.R", package = "Matrix"))# identical3() etc
  Loading required package: tools
  > 
  > if(interactive()) {
  +     options(error = recover, Matrix.verbose = TRUE, warn = 1)
  + } else options(              Matrix.verbose = TRUE, warn = 1)
  >                                         #   ^^^^^^ to show Matrix.msg()s
  > 
  > ### Matrix() ''smartness''
  > (d40 <- Matrix( diag(4)))
  4 x 4 diagonal matrix of class "ddiMatrix"
       [,1] [,2] [,3] [,4]
  [1,]    1    .    .    .
  [2,]    .    1    .    .
  [3,]    .    .    1    .
  [4,]    .    .    .    1
  > (z4 <- Matrix(0*diag(4)))
  4 x 4 diagonal matrix of class "ddiMatrix"
       [,1] [,2] [,3] [,4]
  [1,]    0    .    .    .
  [2,]    .    0    .    .
  [3,]    .    .    0    .
  [4,]    .    .    .    0
  > (o4 <- Matrix(1+diag(4)))
  4 x 4 Matrix of class "dsyMatrix"
       [,1] [,2] [,3] [,4]
  [1,]    2    1    1    1
  [2,]    1    2    1    1
  [3,]    1    1    2    1
  [4,]    1    1    1    2
  > (tr <- Matrix(cbind(1,0:1)))
  2 x 2 Matrix of class "dtrMatrix"
       [,1] [,2]
  [1,]    1    .
  [2,]    1    1
  > (M4 <- Matrix(m4 <- cbind(0,rbind(6*diag(3),0))))
  4 x 4 sparse Matrix of class "dtCMatrix"
              
  [1,] . 6 . .
  [2,] . . 6 .
  [3,] . . . 6
  [4,] . . . .
  > dM4 <- Matrix(M4, sparse = FALSE)
  > d4. <- diag(4); dimnames(d4.) <- dns <- rep(list(LETTERS[1:4]), 2)
  > d4a <- diag(4); dimnames(d4a) <- dna <- list(LETTERS[1:4], letters[1:4])# "a"symmetric
  > m1a <- matrix(0, dimnames=list("A","b"))# "a"symmetric
  > d4di<- as(d4., "diagonalMatrix")
  > d4da<- as(d4a, "diagonalMatrix")
  > d4d <- as(d4., "denseMatrix")
  > d4aS <- Matrix(d4a, sparse=TRUE, doDiag=FALSE)
  > d1aS <- Matrix(m1a, sparse=TRUE, doDiag=FALSE)
  > stopifnot(exprs = {
  +     identical(d4di@x, numeric()) # was "named" unnecessarily
  +     identical(dimnames(d4 <- Matrix(d4.)), dns)
  +     identical4(d40, Matrix(diag(4)), unname(d4), unname(d4da))
  +     identical3(d4, as(d4., "Matrix"), as(d4., "diagonalMatrix"))
  +     is(d4aS, "dtCMatrix") # not "dsC*", as asymmetric dimnames
  +     is(d4d, "denseMatrix")
  +     identical(dimnames(d4T <- as(d4., "TsparseMatrix")), dns) # failed till 2019-09-xx
  +     ## identical(d4T, as(d4., "dsTMatrix")) # deprecated
  + })
  > 
  > class(mN <-  Matrix(NA, 3,4)) # NA *is* logical
  [1] "lgeMatrix"
  attr(,"package")
  [1] "Matrix"
  > validObject(Matrix(NA))
  [1] TRUE
  > bd4 <- bdiag(M4,dM4,M4)
  > stopifnotValid(o4, "dsyMatrix")
  > stopifnotValid(M4, "dtCMatrix")
  > stopifnot(validObject(dM4), validObject(mN),
  +           identical(bdiag(M4), bdiag(dM4)),
  +           identical(bd4@p, c(0L,0:3,3:6,6:9)),
  +           identical(bd4@i, c(0:2, 4:6, 8:10)), bd4@x == 6
  +           )
  > assert.EQ.mat(dM4, m4)
  > assert.EQ.mat(M4^M4, m4^m4)
  > assert.EQ.mat(mN, matrix(NA, 3,4))
  > assert.EQ.mat(bdiag(diag(4)), diag(4))
  > sL <- Matrix(, 3,4, sparse=TRUE)# -> "lgC"
  > trS <- Matrix(tr, sparse=TRUE)# failed in 0.9975-11
  > stopifnotValid(d4, "diagonalMatrix");   stopifnotValid(z4,  "diagonalMatrix")
  > stopifnotValid(tr, "triangularMatrix"); stopifnotValid(trS, "triangularMatrix")
  > stopifnot(all(is.na(sL@x)), ## not yet:  all(is.na(sL)),
  +           !any(sL, na.rm=TRUE), all(!sL, na.rm=TRUE),
  +           validObject(Matrix(c(NA,0), 4, 3, byrow = TRUE)),
  +           validObject(Matrix(c(NA,0), 4, 4)))
  > stopifnotValid(Matrix(c(NA,0,0,0), 4, 4), "sparseMatrix")
  > I <- i1 <- I1 <- Diagonal(1)
  > ## TODO? stopifnot(identical(I, Matrix(1, sparse=TRUE))) # doDiag=TRUE default
  > I1[1,1] <- i1[1, ] <- I [ ,1] <- NA
  > stopifnot(identical3(I,i1,I1))
  > image(d4) # gave infinite recursion
  rectangle size 100.9 x 100.9 [pixels];  --> lwd :1
  > 
  > ## Steve Walker, Mar 12, 2014:
  > n <- 7
  > (M <- triu(Matrix(seq_len(n^2), n, sparse=TRUE)))
  7 x 7 sparse Matrix of class "dtCMatrix"
                         
  [1,] 1 8 15 22 29 36 43
  [2,] . 9 16 23 30 37 44
  [3,] . . 17 24 31 38 45
  [4,] . .  . 25 32 39 46
  [5,] . .  .  . 33 40 47
  [6,] . .  .  .  . 41 48
  [7,] . .  .  .  .  . 49
  > im <- image(M) # was not an n-by-n image plot
  > stopifnot(n == diff(sort(im$y.limits)))
  > ## ylimits were too small (by 1 on each side)
  > 
  > ## Image of *empty*  sparseMatrix (has failed in spite of claim in r3282 | 2018-08-20)
  > (Z <- Matrix(0, 11, 22)) # empty "dgCMatrix"
  11 x 22 sparse Matrix of class "dgCMatrix"
                                                   
   [1,] . . . . . . . . . . . . . . . . . . . . . .
   [2,] . . . . . . . . . . . . . . . . . . . . . .
   [3,] . . . . . . . . . . . . . . . . . . . . . .
   [4,] . . . . . . . . . . . . . . . . . . . . . .
   [5,] . . . . . . . . . . . . . . . . . . . . . .
   [6,] . . . . . . . . . . . . . . . . . . . . . .
   [7,] . . . . . . . . . . . . . . . . . . . . . .
   [8,] . . . . . . . . . . . . . . . . . . . . . .
   [9,] . . . . . . . . . . . . . . . . . . . . . .
  [10,] . . . . . . . . . . . . . . . . . . . . . .
  [11,] . . . . . . . . . . . . . . . . . . . . . .
  > Z0 <- Z; Z0[1,1] <- 1; Z0@x <- 0 ## is also all 0, but not "empty"
  > stopifnot(all(Z == Z0))
  > image(Z)
  rectangle size 34.1 x 8.5 [pixels];  --> lwd :1
  > ## gave Error in seq.default(zrng[1], zrng[2], length.out = cuts + 2) : 'from' must be a finite number
  > image(Z, useAbs=FALSE) # gave *different* Error in seq.int... : 'length.out' must be ...
  rectangle size 34.1 x 8.5 [pixels];  --> lwd :1
  > image(Z0,useAbs=FALSE) #  (ditto)
  rectangle size 34.1 x 8.5 [pixels];  --> lwd :1
  > image(Z0) # had worked previously already
  rectangle size 38.2 x 9.6 [pixels];  --> lwd :1
  > 
  > assertError( Matrix(factor(letters)) )
  > n.lsec <- length(.leap.seconds)# 27 (2017-07)
  > mlp <- matrix(.leap.seconds)## 27 x 1 numeric matrix
  > Mlp <- Matrix(.leap.seconds)
  > stopifnot(identical(dim(Mlp), c(n.lsec, 1L)))
  > assert.EQ.mat(Mlp, mlp)
  > .Leap.seconds <- as.POSIXlt(.leap.seconds)
  > (MLp <- as(.Leap.seconds, "Matrix"))# nice sparse  dgC* w/ col.names
  Error in Matrix(as.matrix(from)) : invalid 'data'
  Calls: as -> asMethod -> Matrix
  Execution halted