RcppCore/RcppEigen — pull request #10 by cheuerde (2014-08-14 16:31:14+00:00)
Title: 'long vectors not supported yet' - Rf_length(x)

When declaring a Eigen::Map from a very big matrix,
I got a runtime error saying long vectors are not supported.
I traced that back to the call 'Rf_length(x)' which is restricted to the pre- R 3.0.0
maximum length of vectors.
I changed all calls of 'Rf_length(x)' to 'Rf_xlength(x)' which will use long vector support
if available. Both are declared in 'Rinterals.h' - lines 323-325

# define XLENGTH(x) (IS_LONG_VEC(x) ? LONG_VEC_LENGTH(x) : SHORT_VEC_LENGTH(x))
# define XTRUELENGTH(x)	(IS_LONG_VEC(x) ? LONG_VEC_TRUELENGTH(x) : SHORT_VEC_TRUELENGTH(x))
# define LENGTH(x) (IS_LONG_VEC(x) ? R_BadLongVector(x, __FILE__, __LINE__) : SHORT_VEC_LENGTH(x))

Of course that change would mean that the package depends R>=3.0.0 but Rcpp has that dependency anyways!

Best,

Claas Heuer