Skip to content

Commit d07d3ef

Browse files
committed
Add externally callable functions for Eigen version and SSE instruction sets in use.
1 parent b994941 commit d07d3ef

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

src/RcppEigen.cpp

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,32 @@
2121

2222
#include <RcppEigen.h>
2323

24-
extern "C" SEXP eigen_version(SEXP single_){
25-
using Rcpp::_;
26-
using Rcpp::IntegerVector;
27-
using Rcpp::wrap;
28-
29-
bool single = Rcpp::as<bool>(single_) ;
30-
if( single ){
31-
return wrap( 10000 * EIGEN_WORLD_VERSION +
32-
100 * EIGEN_MAJOR_VERSION +
33-
EIGEN_MINOR_VERSION ) ;
24+
extern "C" {
25+
SEXP eigen_version(SEXP single_){
26+
using Rcpp::_;
27+
using Rcpp::IntegerVector;
28+
29+
BEGIN_RCPP;
30+
bool single = Rcpp::as<bool>(single_) ;
31+
if( single ){
32+
return Rcpp::wrap( 10000 * EIGEN_WORLD_VERSION +
33+
100 * EIGEN_MAJOR_VERSION +
34+
EIGEN_MINOR_VERSION ) ;
35+
}
36+
37+
return IntegerVector::create(_["major"] = EIGEN_WORLD_VERSION,
38+
_["minor"] = EIGEN_MAJOR_VERSION,
39+
_["patch"] = EIGEN_MINOR_VERSION);
40+
END_RCPP;
3441
}
3542

36-
return IntegerVector::create(_["major"] = EIGEN_WORLD_VERSION,
37-
_["minor"] = EIGEN_MAJOR_VERSION,
38-
_["patch"] = EIGEN_MINOR_VERSION);
43+
SEXP Eigen_SSE() {
44+
BEGIN_RCPP;
45+
return Rcpp::wrap(Eigen::SimdInstructionSetsInUse());
46+
END_RCPP;
47+
}
3948
}
4049

4150

51+
52+

0 commit comments

Comments
 (0)