print("!!! S-Plus and R - Benchmarkprogram !!!") print("================================") print('') print("If you use R, then do |R> dos.time <- system.time") print(" R does not currently show fraction of sec.") print(" Sure would appreciate someone contributing that code") print(" Also interesting will be loop test and mem usage meter") print(" Modified Stefan's work by S. Hoon Yoon on Dec 1, 1998") print(" Visit his web site at http://www.informatik.uni-frankfurt.de/~stst/benchspl.txt") print(" He has same bench for Gauss, Mathlab, Splus, Ox, etc... ") print('') print('') seed <- 400 print(paste(seed, "x", seed, "random matrix^1000 (sec.) : ")) print(dos.time(matrix(runif(seed*seed),seed,seed))) seed <- 300 print(paste("Eigenval. of a ", seed, "x", seed, "random matrix (sec.) :")) x<-matrix(runif(seed*seed),seed,seed) print(dos.time(eigen(x))) seed <- 500 print(paste("Inverse of a ", seed, "x", seed, " random matrix (sec.) :")) x<-matrix(runif(seed*seed),seed,seed) print(dos.time(solve(x))) print(paste(seed*1000, " values sorted ascending (sec.) :")) x<-runif(seed*1000) print(dos.time(sort(x))) seed <- 800 print(paste(seed, "x", seed, "Toeplitzmatrix (sec.) :")) "top" <- function (n = 4) { mat <- matrix(ncol = n, nrow = n, byrow = F) mat[, 1] <- 1:n mat[, n] <- n:1 for (i in seq(2, n - 1)) mat[, i] <- c(seq(i, 1), seq(2, n - i + 1)) mat } print(dos.time(top(seed))) seed <- 500 print(paste("Cholesky decomposition of a", seed, "x", seed, "-matrix (sec.) :")) x<-matrix(runif(seed*seed),seed,seed) x<-crossprod(x,x) print(dos.time(chol(x))) print(paste(seed, "x", seed, "cross-product matrix (sec.) :")) x<-matrix(runif(seed*seed),seed,seed) print(dos.time(crossprod(x,x))) seed <- 100000 print(paste("FFT over", seed, "values (sec.) :")) x<-runif(seed) print(dos.time(fft(x))) print(paste("Gaussian error function over a", seed, "x", seed, "matrix (sec.) :")) seed <- 600 print(paste("Gamma function over a ", seed, "x", seed, " matrix (sec.) :")) x<-matrix(runif(360000),600,600) print(dos.time(gamma(x))) seed <- 500 print(paste("Linear regression over a", seed, "x", seed, "matrix (sec.) :")) x<-matrix(runif(250000),500,500) y<-runif(500) print(dos.time(lsfit(x,y)))