Installation of the xtensor-r C++ library

xtensor-r is a header-only C++ library. We maintain the conda package for xtensor-r and its dependencies.

Besides the xtendor-r headers, all these methods place the cmake project configuration file in the right location so that third-party projects can use cmake’s find_package to locate xtensor-r headers.

_images/conda.svg

Using the conda package

A package for xtensor-r is available on the conda package manager.

conda install -c conda-forge xtensor-r
_images/cmake.svg

From source with cmake

You can also install xtensor-r from source with cmake. On Unix platforms, from the source directory:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/path/to/prefix ..
make install

On Windows platforms, from the source directory:

mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=/path/to/prefix ..
nmake
nmake install
_images/cran.svg

Installation of the R package

We provide a R package for Xtensor on both conda and CRAN (Comprehensive R Archive Network). The packaging boilerplate for the R package is available at https://github.com/QuantStack/Xtensor.R.

To install the R package with conda:

conda install r-xtensor -c conda-forge

To install the R package from CRAN:

R CMD INSTALL xtensor

or from the GitHub repository using devtools:

devtools::install_github("QuantStack/Xtensor.R")

Note

A key difference between the version of the R package available on CRAN and conda is that

  • the CRAN package vendors the headers of xtl, xsimd, xtensor, and xtensor-r.
  • the conda package depends on the conda packages for xtl, xsimd, xtensor and xtensor-r.

When installing the package from CRAN, it is still possible to drop the vendored dependencies by adding the --configure-args='--novendor' option to the R CMD INSTALL command, or by defining the NO_VENDOR_XTENSOR environment variable to YES.