Last active
August 29, 2015 14:24
-
-
Save j-martens/a4d2fb38ed15147f7e47 to your computer and use it in GitHub Desktop.
MKL Performance Benchmark 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set MKL threads if Revolution R Open or Revolution R Enterprise is available | |
if(require("RevoUtilsMath")){ | |
setMKLthreads(4) | |
} | |
# Initialization | |
set.seed (1) | |
m <- 10000 | |
n <- 5000 | |
A <- matrix (runif (m*n),m,n) | |
# Matrix multiply | |
system.time (B <- crossprod(A)) | |
# Cholesky Factorization | |
system.time (C <- chol(B)) | |
# Singular Value Decomposition | |
m <- 10000 | |
n <- 2000 | |
A <- matrix (runif (m*n),m,n) | |
system.time (S <- svd (A,nu=0,nv=0)) | |
# Principal Components Analysis | |
m <- 10000 | |
n <- 2000 | |
A <- matrix (runif (m*n),m,n) | |
system.time (P <- prcomp(A)) | |
# Linear Discriminant Analysis | |
library('MASS') | |
g <- 5 | |
k <- round (m/2) | |
A <- data.frame (A, fac=sample (LETTERS[1:g],m,replace=TRUE)) | |
train <- sample(1:m, k) | |
system.time (L <- lda(fac ~., data=A, prior=rep(1,g)/g, subset=train)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment