celestialgod

Rcpp call F77 BLAS/LAPACK

Jan 1st, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.54 KB | None | 0 0
  1. Sys.setenv("PKG_LIBS" = "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)")
  2. Rcpp::sourceCpp("eigen_sym_cpp.cpp")
  3.  
  4. n_row <- 1e4L
  5. n_col <- 5e1L
  6. A <- matrix(rnorm(n_row * n_col), n_row, n_col)
  7. S <- cov(A)
  8.  
  9. library(microbenchmark)
  10. microbenchmark(
  11.   Rcpp_BLAS = eigen_sym_cpp(S),
  12.   R = eigen(S),
  13.   times = 100L)
  14. # Unit: microseconds
  15. #      expr      min       lq      mean    median       uq      max neval
  16. # Rcpp_BLAS  789.644  874.196  904.5647  891.4575  943.974 1545.057   100
  17. #         R 1194.267 1344.793 1444.1375 1404.7695 1516.385 3655.062   100
Advertisement
Add Comment
Please, Sign In to add comment