diff --git a/ChangeLog b/ChangeLog index c10350df..2d6e6347 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-09-29 Dirk Eddelbuettel + + * inst/include/RcppArmadillo/interface/RcppArmadilloAs.h: Add icube + exporter specialisation under ARMA_64BIT_WORD case + 2024-09-11 Dirk Eddelbuettel * DESCRIPTION (Version, Date): RcppArmadillo 14.0.2-1 CRAN release diff --git a/DESCRIPTION b/DESCRIPTION index 723c9cd4..c36a7321 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: RcppArmadillo Type: Package Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library -Version: 14.0.2-1 +Version: 14.0.2-1.1 Date: 2024-09-10 Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org", comment = c(ORCID = "0000-0001-6419-907X")), diff --git a/inst/include/RcppArmadillo/interface/RcppArmadilloAs.h b/inst/include/RcppArmadillo/interface/RcppArmadilloAs.h index e6dc8a72..50394cd5 100644 --- a/inst/include/RcppArmadillo/interface/RcppArmadilloAs.h +++ b/inst/include/RcppArmadillo/interface/RcppArmadilloAs.h @@ -483,9 +483,31 @@ namespace traits { Rcpp::Vector vec; }; - // specializations for 3 cube typedefs that fail above - // first use viable conversion SEXP -> Cube + // specializations for 3 (or 4, see below) cube typedefs that + // fail above first use viable conversion SEXP -> Cube // then use conv_to::from(other_t other) +#ifdef ARMA_64BIT_WORD + // if we use ARMA_64BIT_WORD we cannot pass int through and + // need a fourth specialization similar to the other three + template <> + class Exporter { + public: + typedef arma::icube cube_t; + + Exporter(SEXP x) + : tmp(Exporter(x).get()) {} + + cube_t get() { + cube_t result = arma::conv_to::from(tmp); + return result; + } + + private: + typedef arma::cube other_t; + other_t tmp; + }; +#endif + template <> class Exporter { public: diff --git a/inst/tinytest/test_rng.R b/inst/tinytest/test_rng.R index d00d3c15..9de2165c 100644 --- a/inst/tinytest/test_rng.R +++ b/inst/tinytest/test_rng.R @@ -52,7 +52,8 @@ expect_true(max(a) < 1)#, msg="randu max") set.seed(123) a <- randi(10) expect_true(min(a) > 0)#, msg="randi min") -expect_true(typeof(a) == "integer")#, msg="randi type") +## under ARMA_64BIT_WORD we get 'double' +expect_true(typeof(a) == "integer" || typeof(a) == "double")#, msg="randi type") #test.randn <- function() { set.seed(123)