Running ‘checker.R’ [0s/1s]
Running the tests in ‘tests/checker.R’ failed.
Complete output:
  > require(tensorA)
  Loading required package: tensorA
  
  Attaching package: 'tensorA'
  
  The following object is masked from 'package:base':
  
      norm
  
  > if(FALSE) {
  +   # Commands for testing
  +   debugger()
  +   rm(list=objects())
  +   options(error=dump.frames)
  +   detach("package:tensorA")
  +   dyn.unload("/home/boogaart/R/tensorA/tests/../../tensorA.Rcheck/tensorA/libs/tensorA.so")
  +   library(tensorA,lib.loc="../../tensorA.Rcheck")
  + }
  > 
  > set.seed(23)
  > 
  > 
  > summary.tensor <- function(x,...) {
  +   n <- level.tensor(x)
  +   d <- dim(x)
  +   dm <- pmin(d,1)
  +   dm2<- pmin(d,2)
  +   print(dim(x))
  +   if( !all(sapply(dimnames(x),is.null))) print(dimnames(x))
  +   if( prod(dim(x)) < 10 )
  +     print(x)
  +   else if( n == 1 )
  +     print(x[1:min(length(x),10)])
  +   else if( n == 2 )
  +     print(x[1:dm[1],1:dm[2]])
  +   else if( n == 3 )
  +     print(x[1:dm[1],1:dm[2],1:dm2[3],drop=FALSE])
  +   else if( n == 4 )
  +     print(x[1:(dm2[1]),1:dm[1],1,1,drop=FALSE])
  +   else if( n == 5 )
  +     print(x[1:(dm2[1]),1:dm[1],1,1,1,drop=FALSE])
  +   else if( n == 6 )
  +     print(x[1:(dm2[1]),1:dm[1],1,1,1,1,drop=FALSE])
  +   else
  +     print(x[1:min(length(x),10)])
  + }
  > 
  > checker <- function(x,y) UseMethod("checker")
  > 
  > checker.default <- function(x,y) {
  +     cat("Wrong type\n",deparse(match.call()),"\n---------------y=\n")
  +     print(y)
  +     cat("\n------------x=\n")
  +     print(x)
  +     stop("Unkown type")
  + }
  > 
  > 
  > checker.tensor <- function(x,y) {
  +   if( !cmp(x,y) ) {
  +     cat("Misfit\n",deparse(match.call()),"\n------------------y=\n")
  +     print(y)
  +     cat("\n-----------------------x=\n")
  +     print(x)
  + #    print(summary(x))
  + #    print(summary(y))
  +     stop("Missfit");
  +   } else {
  +     x
  +   }
  + }
  > 
  > print.tensor <- function(x){
  +   print.default(unclass(x))
  +   print(dim(x))
  + }
  > 
  > cmp.tensor <- function(x,y) {
  +   if(!is.null(names(y))) {
  +     mat <- match(names(y),names(x))
  +     if( any(is.na(mat)) ) {
  +       print(names(y))
  +       print(names(x))
  +       return(FALSE)
  +     }
  +     else
  +       x <- reorder.tensor(x,mat)
  +   }
  +   return( length(x)==length(y) && !any(is.na(x)) && 
  +          sum(abs(c(x)-c(y))^2)<1E-10 &&
  +          length(dim(x))==length(dim(y)) &&
  +          !any(is.na(dim(x))) && !any(is.na(dim(y))) &&         
  +          all(dim(x)==dim(y)))
  + }
  >   
  > cmp <- function(x,y) UseMethod("cmp")
  > 
  > cmp.character <- function(x,y) {
  +   return( length(x)==length(y) && all(x==y) )
  + }
  > 
  > 
  > cmp.numeric <- function(x,y){
  +   if( length(x) != length(y) )
  +     return(FALSE)
  +   if(!is.null(names(y))) {
  +     if( is.null(names(y)) || !all( names(x) %in% names(y) ) )
  +       return(FALSE)
  +     if( ! identical(any( x[match(names(y),names(x))]!=y ),FALSE) )
  +       return(FALSE)
  +     return(TRUE)
  +   } else {
  +     return(all(x==y))
  +   }
  + }
  > 
  > cmp.default <- function(x,y) identical(x,y)
  > 
  > checker.numeric <- function(x,y) {
  +   if( !cmp(x,y) ) {
  +     cat("Misfit\n",deparse(match.call()),"\n-----------------y=\n")
  +     print(y)
  +     cat("\n-------------------------x=\n")
  +     print(x)
  +     stop("Missfit");
  +   } else print(x)
  + }
  > 
  > 
  > checker.character <- function(x,y) {
  +   if( !cmp(x,y) ) {
  +     cat("Misfit\n",deparse(match.call()),"\n-----------------y=\n")
  +     print(y)
  +     cat("\n----------------------------y=\n")
  +     print(x)
  +     stop("Missfit");
  +   } else print(x)
  + }
  > 
  > checker.list <- function(x,y) {
  +   if( length(x) != length(y) || identical(!all(mapply(cmp,x,y)),TRUE) ) {
  +     cat("Misfit\n",deparse(match.call()),"\n---------------y=\n")
  +     print(y)
  +     cat("\n----------------------x=\n")
  +     print(x)
  +     stop("Missfit");
  +   } else print(x)    
  + }
  > 
  > nn <- function(...,nn=list(...)) {
  +   lapply(1:length(nn),function(i) paste(names(nn)[i],1:nn[[i]],sep=""))
  +  }
  > 
  > 
  > 
  > # to.tensor
  > I4 <- diag(4)
  > names(dim(I4))<-c("Q","z")
  > checker(to.tensor(I4,c(a=2,b=2)),
  +         to.tensor(c(diag(4)),c(a=2,b=2,z=4)))
  , , 1
  
        b
  a      [,1] [,2]
    [1,]    1    0
    [2,]    0    0
  
  , , 2
  
        b
  a      [,1] [,2]
    [1,]    0    0
    [2,]    1    0
  
  , , 3
  
        b
  a      [,1] [,2]
    [1,]    0    1
    [2,]    0    0
  
  , , 4
  
        b
  a      [,1] [,2]
    [1,]    0    0
    [2,]    0    1
  
  a b z 
  2 2 4 
  > 
  > dimnames(I4) <- nn(Q=4,z=4)
  > checker(to.tensor(I4,c(a=2,b=2),nn(a=2,b=2)),
  +         to.tensor(c(diag(4)),c(a=2,b=2,z=4),nn(a=2,b=2,z=4)))
  , , z = z1
  
      b
  a    b1 b2
    a1  1  0
    a2  0  0
  
  , , z = z2
  
      b
  a    b1 b2
    a1  0  0
    a2  1  0
  
  , , z = z3
  
      b
  a    b1 b2
    a1  0  1
    a2  0  0
  
  , , z = z4
  
      b
  a    b1 b2
    a1  0  0
    a2  0  1
  
  a b z 
  2 2 4 
  > 
  > 
  > #
  > 
  > KT5 <- to.tensor(rnorm(30),c(a=3,b=2,c=5),nn(a=3,b=2,c=5))
  > dim(KT5[[c=2]])
  a b 
  3 2 
  > dim(KT5[,,1:2])
  a b c 
  3 2 2 
  > summary(KT5)
  a b c 
  3 2 5 
  $a
  [1] "a1" "a2" "a3"
  
  $b
  [1] "b1" "b2"
  
  $c
  [1] "c1" "c2" "c3" "c4" "c5"
  
  , , 1
  
        b
  a           [,1]
    [1,] 0.1932123
  
  , , 2
  
        b
  a            [,1]
    [1,] -0.2780863
  
  a b c 
  1 1 2 
  > 
  > KT5 <- to.tensor(rnorm(30),c(a=3,b=10,c=1),nn(a=3,b=10,c=1))
  > drop(KT5)
      b
  a             b1         b2        b3       b4         b5          b6
    a1 -0.55320524 -1.2499273  1.307647 0.232875  0.9459580 -1.62920594
    a2  0.09818141 -0.2021117 -1.342935 1.042257 -0.9856255  0.09231624
    a3 -1.14666586  0.1775003  0.861083 1.329098 -1.2158668 -0.02211742
      b
  a            b7         b8         b9       b10
    a1  0.5134779 -0.2384356  1.2208190 0.2772344
    a2 -0.2295536 -1.9978126 -0.8509239 0.9707189
    a3  1.2615159  0.7010760 -0.5636078 0.9526308
   a  b 
   3 10 
  > 
  > checker(as.tensor(KT5),KT5)
  Error in UseMethod("as.tensor") : 
    no applicable method for 'as.tensor' applied to an object of class "tensor"
  Calls: checker -> as.tensor
  Execution halted