search for: findgradi

Displaying 1 result from an estimated 1 matches for "findgradi".

2011 Dec 23
2
missing value where TRUE/FALSE needed
...ncol(data) n.rows <- nrow(data) X <- as.matrix(data) stepsize <- 0.05 c1 <- (2 * pi) ** (n.cols / 2) c2 <- n.rows * (smoothing ** (n.cols + 2)) c3 <- n.rows * (smoothing ** n.cols) Kexp <- function(sqs){ return (exp((-1 * sqs) / (2 * smoothing ** 2))) } FindGradient <- function(x){ XmY <- t(x - t(X)) sqsum <- rowSums(XmY * XmY) K <- sapply(sqsum, Kexp) dens <- ((c1 * c3) ** -1) * sum(K) grad <- -1 * ((c1 * c2) ** -1) * colSums(K * XmY) return (list(gradient = grad, density = dens)) } attractors...