- Notifications
You must be signed in to change notification settings - Fork16
xtensor-stack/xtensor-r
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
R bindings for thextensor C++ multi-dimensional array library.
xtensoris a C++ library for multi-dimensional arrays enabling numpy-style broadcasting and lazy computing.xtensor-renables inplace use of R arrays in C++ with all the benefits fromxtensor- C++ universal functions and broadcasting
- STL - compliant APIs.
- A broad coverage of numpy APIs (seethe numpy to xtensor cheat sheet).
xtensor-r can be used either to author C++ extensions for R withRcpp, or applications that embed the R interpreter withRInside.
#include<numeric>// Standard library import for std::accumulate#defineSTRICT_R_HEADERS// Otherwise a PI macro is defined in R#include"xtensor/xmath.hpp"// xtensor import for the C++ universal functions#include"xtensor-r/rarray.hpp"// R bindings#include<Rcpp.h>usingnamespaceRcpp;// [[Rcpp::plugins(cpp14)]]// [[Rcpp::export]]doublesum_of_sines(xt::rarray<double>& m){auto sines =xt::sin(m);// sines does not actually hold values.returnstd::accumulate(sines.cbegin(), sines.cend(),0.0);}
v<-matrix(0:14,nrow=3,ncol=5)s<- sum_of_sines(v)s# prints 1.2853996391883833
xtensor-r a header-only C++ library. It has been packaged for the mamba (or conda) package manager.
mamba install xtensor-r -c conda-forge
xtensor-r can be installed from source with cmake in any installation prefix. For example, on unix systems
cmake -D CMAKE_INSTALL_PREFIX=/prefix/path/.makemake installWe provide a R package for Xtensor on both conda and CRAN (Comprehensive R Archive Network).The packaging boilerplate for the R package is available athttps://github.com/xtensor-stack/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("xtensor-stack/Xtensor.R")
The CRAN package vendors the headers forxtensor-r, xtensor,xtlandxsimd`.
To get started with usingxtensor-r, check out the full documentation
http://xtensor-r.readthedocs.io/
xtensor-r depends on thextensor andRcpp libraries
xtensor-r | xtensor | Rcpp |
|---|---|---|
| master | ^0.27.0 | ^1.0 |
| 0.17.0 | ^0.27.0 | ^1.0 |
| 0.16.0 | ^0.26.0 | ^1.0 |
| 0.15.0 | ^0.25.0 | ^1.0 |
| 0.14.2 | ^0.24.4 | ^1.0 |
| 0.14.1 | ^0.24.0 | ^1.0 |
| 0.14.0 | ^0.24.0 | ^1.0 |
| 0.13.0 | ^0.23.0 | ^1.0 |
| 0.12.1 | ^0.21.4 | ^1.0 |
| 0.12.0 | ^0.21.2 | ^1.0 |
- Core
xtensorheaders are vendored in the CRAN package. - When using the conda, or debian package managers, xtensor-r has a dependency on xtensor.
We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.
This software is licensed under the BSD-3-Clause license. See theLICENSE file for details.
About
R bindings for xtensor
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors9
Uh oh!
There was an error while loading.Please reload this page.