tests/testthat/optimCheck-testfunctions.R

#--- package test functions ----------------------------------------------------

# generate an n x p matrix of iid N(0,1)
rMnorm <- function(n, p) {
  if(missing(p)) p <- n
  matrix(rnorm(n*p), n, p)
}

# max of min of abs and rel error
max.xdiff <- function(x) {
  xdiff <- abs(diff(x))
  max(pmin(xdiff[,1], xdiff[,2]))
}

Try the optimCheck package in your browser

Any scripts or data that you put into this service are public.

optimCheck documentation built on Oct. 9, 2019, 9:05 a.m.