Running 'tfnchk.R' [168s]
  Running 'tgrchk.R' [162s]
  Running 'tkktc.R' [0s]
Running the tests in 'tests/tfnchk.R' failed.
Complete output:
  > require(optextras)
  Loading required package: optextras
  > cat("Show how fnchk works\n")
  Show how fnchk works
  > 
  > 
  > 
  > # Want to illustrate each case.
  > # Ben Bolker idea for a function that is NOT scalar
  > 
  > benbad<-function(x, y){
  +    # y may be provided with different structures
  +    f<-(x-y)^2
  + } # very simple, but ...
  > 
  > y<-1:10
  > x<-c(1)
  > cat("test benbad() with y=1:10, x=c(1)\n")
  test benbad() with y=1:10, x=c(1)
  > fc01<-fnchk(x, benbad, trace=1, y)
  Function value at supplied parameters = [1]  0  1  4  9 16 25 36 49 64 81
   num [1:10] 0 1 4 9 16 25 36 49 64 81
  NULL
  [1] TRUE
  Function evaluation returns a vector not a scalar 
  Function evaluation returned non-numeric value 
  Function evaluation returned Inf or NA (non-computable) 
  Function at given point= NA 
  > print(fc01)
  $fval
  [1] NA
  
  $infeasible
  [1] TRUE
  
  $excode
  [1] -1
  
  $msg
  [1] "Function evaluation returned Inf or NA (non-computable)"
  
  > 
  > y<-as.vector(y)
  > cat("test benbad() with y=as.vector(1:10), x=c(1)\n")
  test benbad() with y=as.vector(1:10), x=c(1)
  > fc02<-fnchk(x, benbad, trace=1, y)
  Function value at supplied parameters = [1]  0  1  4  9 16 25 36 49 64 81
   num [1:10] 0 1 4 9 16 25 36 49 64 81
  NULL
  [1] TRUE
  Function evaluation returns a vector not a scalar 
  Function evaluation returned non-numeric value 
  Function evaluation returned Inf or NA (non-computable) 
  Function at given point= NA 
  > print(fc02)
  $fval
  [1] NA
  
  $infeasible
  [1] TRUE
  
  $excode
  [1] -1
  
  $msg
  [1] "Function evaluation returned Inf or NA (non-computable)"
  
  > 
  > y<-as.matrix(y)
  > cat("test benbad() with y=as.matrix(1:10), x=c(1)\n")
  test benbad() with y=as.matrix(1:10), x=c(1)
  > fc03<-fnchk(x, benbad, trace=1, y)
  Function value at supplied parameters =      [,1]
   [1,]    0
   [2,]    1
   [3,]    4
   [4,]    9
   [5,]   16
   [6,]   25
   [7,]   36
   [8,]   49
   [9,]   64
  [10,]   81
   num [1:10, 1] 0 1 4 9 16 25 36 49 64 81
  NULL
  [1] FALSE
  Function evaluation returns a matrix list not a scalar 
  Function evaluation returned non-numeric value 
  Function evaluation returned Inf or NA (non-computable) 
  Function at given point= NA 
  > print(fc03)
  $fval
  [1] NA
  
  $infeasible
  [1] TRUE
  
  $excode
  [1] -1
  
  $msg
  [1] "Function evaluation returned Inf or NA (non-computable)"
  
  >    
  > y<-as.array(y)
  > cat("test benbad() with y=as.array(1:10), x=c(1)\n")
  test benbad() with y=as.array(1:10), x=c(1)
  > fc04<-fnchk(x, benbad, trace=1, y)
  Function value at supplied parameters =      [,1]
   [1,]    0
   [2,]    1
   [3,]    4
   [4,]    9
   [5,]   16
   [6,]   25
   [7,]   36
   [8,]   49
   [9,]   64
  [10,]   81
   num [1:10, 1] 0 1 4 9 16 25 36 49 64 81
  NULL
  [1] FALSE
  Function evaluation returns a matrix list not a scalar 
  Function evaluation returned non-numeric value 
  Function evaluation returned Inf or NA (non-computable) 
  Function at given point= NA 
  > print(fc04)
  $fval
  [1] NA
  
  $infeasible
  [1] TRUE
  
  $excode
  [1] -1
  
  $msg
  [1] "Function evaluation returned Inf or NA (non-computable)"
  
  >    
  > y<-"This is a string"
  > cat("test benbad() with y a string, x=c(1)\n")
  test benbad() with y a string, x=c(1)
  > fc05<-fnchk(x, benbad, trace=1, y)
  Error in x - y : non-numeric argument to binary operator
  Function value at supplied parameters =[1] NA
  attr(,"inadmissible")
  [1] TRUE
   logi NA
   - attr(*, "inadmissible")= logi TRUE
  NULL
  [1] FALSE
  Function evaluation returns INADMISSIBLE 
  Function evaluation returned non-numeric value 
  Function evaluation returned Inf or NA (non-computable) 
  Function at given point= NA 
  > print(fc05)
  $fval
  [1] NA
  
  $infeasible
  [1] TRUE
  
  $excode
  [1] -1
  
  $msg
  [1] "Function evaluation returned Inf or NA (non-computable)"
  
  > 
  > fr <- function(x) {   ## Rosenbrock Banana function
  +     x1 <- x[1]
  +     x2 <- x[2]
  +     100 * (x2 - x1 * x1)^2 + (1 - x1)^2
  + }
  > xtrad<-c(-1.2,1)
  > ros1<-fnchk(xtrad, fr, trace=1)
  Function value at supplied parameters =[1] 24.2
   num 24.2
  NULL
  [1] TRUE
  Function at given point= 24.2 
  > print(ros1)
  $fval
  [1] 24.2
  
  $infeasible
  [1] FALSE
  
  $excode
  [1] 0
  
  $msg
  [1] "fnchk OK"
  
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.21    0.04    0.25 
Running the tests in 'tests/tgrchk.R' failed.
Complete output:
  > cat("Show how grchk works\n")
  Show how grchk works
  > require(optextras)
  Loading required package: optextras
  > require(numDeriv)
  Loading required package: numDeriv
  > 
  > jones<-function(xx){
  +   x<-xx[1]
  +   y<-xx[2]
  +   ff<-sin(x*x/2 - y*y/4)*cos(2*x-exp(y))
  +   ff<- -ff
  + }
  > 
  > jonesg <- function(xx) {
  +   x<-xx[1]
  +   y<-xx[2]
  +   gx <-  cos(x * x/2 - y * y/4) * ((x + x)/2) * cos(2 * x - exp(y)) - 
  +     sin(x * x/2 - y * y/4) * (sin(2 * x - exp(y)) * 2)
  +   gy <- sin(x * x/2 - y * y/4) * (sin(2 * x - exp(y)) * exp(y)) - cos(x * 
  +                                                                         x/2 - y * y/4) * ((y + y)/4) * cos(2 * x - exp(y))
  +   gg <- - c(gx, gy)
  + }
  > 
  > xx <- c(1, 2)
  > 
  > gcans <- grchk(xx, jones, jonesg, trace=1, testtol=(.Machine$double.eps)^(1/3))
  gradient test tolerance =  6.055454e-06   fval= 0.3002153 
   compare to max(abs(gn-ga))/(1+abs(fval)) =  1.312852e-11 
  > gcans
  [1] TRUE
  attr(,"ga")
  [1] -1.297122  3.311502
  attr(,"gn")
  [1] -1.297122  3.311502
  > 
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.26    0.06    0.32