R/minConf_TMP_polyval.R

polyval_from_pracma <- function (p, x) 
{
  p = as.vector(p)
  if (length(x) == 0) 
    return(c())
  if (length(p) == 0) 
    return(0 * x)
  if (!is.vector(p, mode = "numeric") && !is.vector(p, mode = "complex")) 
    stop("Argument 'p' must be a real or complex vector.")
  if (!is.vector(x) && !is.matrix(x)) 
    stop("Argument 'x' must be a real or complex matrix.")
  n <- length(p)
  y <- outer(x[1:length(x)], (n - 1):0, "^") %*% p
  dim(y) <- dim(x)
  return(y)
}
cwliu007/minConf documentation built on May 31, 2019, 10:01 a.m.