Skip to content

Instantly share code, notes, and snippets.

@andrie
Last active December 15, 2023 10:20

Revisions

  1. andrie revised this gist Jul 13, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions rro-mkl-benchmark.R
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Set MKL threads if Revolution R Open or Revoltion R Enterprise is available
    # Set MKL threads if Revolution R Open or Revolution R Enterprise is available

    if(require(Revobase)){
    if(require("RevoUtilsMath")){
    setMKLthreads(4)
    }

  2. andrie created this gist Oct 17, 2014.
    39 changes: 39 additions & 0 deletions rro-mkl-benchmark.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    # Set MKL threads if Revolution R Open or Revoltion R Enterprise is available

    if(require(Revobase)){
    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 Deomposition
    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))