Learn R Programming

RcppXsimd

Overview

This library provides an Rcpp wrapper around Xsimd that is a modern, portable C++14 header-only library for SIMD intrinsics and parallelized, optimized math implementations.

Example

library(RcppXsimd)
?supportsAVX

if (supportsAVX()) {
  Sys.setenv(PKG_CPPFLAGS = "-mavx")
  Rcpp::sourceCpp(verbose = TRUE, code='
    // [[Rcpp::plugins(cpp14)]]
    // [[Rcpp::depends(RcppXsimd)]]

    #include <Rcpp.h>
    #include "xsimd/xsimd.hpp"

    // [[Rcpp::export]]
    void demoAVX() {
      xsimd::batch<double, 4> a(1.0);
      xsimd::batch<double, 4> b(1.0);
      Rcpp::Rcout << a << " + " << b << " = " << (a + b) << std::endl;
    }')
  demoAVX()
} else {
  message("AVX is not supported")
}

Development status

RcppXsimd is being developed in R Studio.

Acknowledgements

  • This project is supported in part through the National Science Foundation grant DMS 1264153.

Copy Link

Version

Install

install.packages('RcppXsimd')

Monthly Downloads

338

Version

7.1.6-2

License

BSD_3_clause + file LICENSE

Maintainer

Marc A Suchard

Last Published

January 22nd, 2026

Functions in RcppXsimd (7.1.6-2)

getAVXFlags

Concatenate supported AVX compiler flags for system CPU
getSimdFeatures

Poll OS and CPU for SIMD feature support
supportsAVX

Determine if CPU supports AVX SIMD instructions
RcppXsimd

RcppXsimd: Rcpp wrapper to Xsimd
getAVX512Flags

Concatenate supported AVX512 compiler flags for system CPU
supportsNEON

Determine if CPU supports NEON SIMD instructions
supportsAVX512

Determine if CPU supports AVX512 SIMD instructions
getSSEFlags

Concatenate supported SSE compiler flags for system CPU
getNEONFlags

Concatenate supported NEON compiler flags for system CPU
supportsSSE

Determine if CPU supports SSE SIMD instructions