Revision 03698027c2d84118bd0c53c4a9a5b5d23676f388 authored by HwB on 01 October 2012, 00:00:00 UTC, committed by Gabor Csardi on 01 October 2012, 00:00:00 UTC
1 parent 9fdea5d
polyval.R
###
### POLYVAL.R Polynom
###
polyval <- function(p, x) {
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)
}
Computing file changes ...