diff --git a/src/Makevars.in b/src/Makevars.in index bc8af66..29d5fb6 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,5 +1,3 @@ PKG_CPPFLAGS = -DARMA_32BIT_WORD -I../inst/include/ -DRSPARSE_R_PKG -DARMA_NO_DEBUG PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) @FLOAT_LIBS@ $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) - -CXX_STD = CXX11 diff --git a/src/Makevars.win b/src/Makevars.win index 2cf0426..28faff0 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -4,5 +4,3 @@ FLOAT_LIBS = $(shell ${R_SCMD} "float:::ldflags()") PKG_CPPFLAGS = -I../inst/include/ -DARMA_32BIT_WORD -DARMA_DONT_USE_BLAS -DARMA_NO_DEBUG -DRSPARSE_R_PKG PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(FLOAT_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) - -CXX_STD = CXX11 diff --git a/src/utils.cpp b/src/utils.cpp index ac0af28..f42e3e3 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -113,16 +113,17 @@ const std::string currentDateTime() { } arma::fmat extract_float_matrix(Rcpp::S4 x) { - Rcpp::IntegerMatrix x_data = x.slot("Data"); - float* ptr = reinterpret_cast(&x_data[0]); - arma::fmat x_mapped = arma::fmat(ptr, x_data.nrow(), x_data.ncol(), false, true); + SEXP x_data = x.slot("Data"); + SEXP dims = Rf_getAttrib(x_data, R_DimSymbol); + float* ptr = reinterpret_cast(INTEGER(x_data)); + arma::fmat x_mapped = arma::fmat(ptr, INTEGER(dims)[0], INTEGER(dims)[1], false, true); return (x_mapped); } arma::fvec extract_float_vector(Rcpp::S4 x) { - Rcpp::IntegerVector x_data = x.slot("Data"); - float* ptr = reinterpret_cast(&x_data[0]); - arma::fvec x_mapped = arma::fvec(ptr, x_data.length(), false, true); + SEXP x_data = x.slot("Data"); + float* ptr = reinterpret_cast(INTEGER(x_data)); + arma::fvec x_mapped = arma::fvec(ptr, Rf_xlength(x_data), false, true); return (x_mapped); }