[Rcpp-devel] Status of ARMA_64BIT_WORD in RcppArmadillo

Balamuta, James Joseph balamut2 at illinois.edu
Mon Dec 15 06:28:37 CET 2014


Thanks!

One last question, this is the proper way to set the flags in src/Makevars?

PKG_CXXFLAGS=-I../inst/include -DARMA_64BIT_WORD
PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
CXX_STD = CXX11

Sincerely,

JJB
________________________________________
From: Dirk Eddelbuettel [edd at debian.org]
Sent: Sunday, December 14, 2014 10:14 PM
To: Balamuta, James Joseph
Cc: rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] Status of ARMA_64BIT_WORD in RcppArmadillo

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