[Rcpp-devel] Status of ARMA_64BIT_WORD in RcppArmadillo
Dirk Eddelbuettel
edd at debian.org
Mon Dec 15 05:14:17 CET 2014
On 15 December 2014 at 03:49, Balamuta, James Joseph wrote:
| Greetings and Salutations All,
|
| Recently, I've had the need to collide large matrices 1x10^7 using code written
| in RcppArmadillo.
|
| Initially, I triggered:
| Error: Mat::init(): requested size is too large; suggest to enable
| ARMA_64BIT_WORD
|
| Upon a quick search, I stumbled upon a Stack Exchange post by Dirk:
| http://stackoverflow.com/a/16159326/1345455
|
| "Update on 2013-04-30: This was actually an Armadillo bug, which was just fixed
| upstream. A new RcppArmadillo verion 0.3.810.2 is now in SVN, and should
| migrate soon to CRAN shortly. You no longer need to define ARMA_64BIT_WORD."
|
| Upon opening,
|
| [R.home()]/lib/R/library/RcppArmadillo/include/RcppArmadilloConfig.h
|
|
| #define ARMA_64BIT_WORD
|
|
| The above definition not listed.
|
| Two quick questions:
| 1. Was the default support for ARMA_64BIT_WORD removed? (RcppArmadillo >=
| 0.4.5.550.1.0) If not, is there a trigger I need to add to my source to ensure
| ARMA_64BIT_WORD is active?
| 2. If I make the code I'm currently working on available as a package on CRAN,
| would I have to direct users to modify the RcppArmadilloConfig.h?
There are two or three things to consider:
i) R itself now extended indices; Rcpp has not carried this over
ii) Armadillo can deal with bigger data. From config.hpp:
#if !defined(ARMA_64BIT_WORD)
// #define ARMA_64BIT_WORD
//// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements.
//// Your machine and compiler must have support for 64 bit integers (eg. via "long" or "long long")
#endif
iii) We cannot generally enable these features as we do not generally have
long long (as previously discussed and in other place -- compilers and
C++ supported this for years; R insists on the oldest standard which
does not have it).
So I would think that by doing both of
a) enabling C++11 to get long long
b) defining ARMA_64BIT_WORD
both of which can be done in your src/Makevars, you should be set.
But per i) above you can't bring such large matrices into R yet. But you can
write C++ code to work on them, and maybe your result set then is smaller.
Hth, Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel
mailing list