Skip to content

Commit 7f837a0

Browse files
committed
Force ARMA_64BIT_WORD
1 parent 678ca11 commit 7f837a0

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: RcppArmadillo
22
Type: Package
33
Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library
4-
Version: 14.0.2-1
4+
Version: 14.0.2-1.1
55
Date: 2024-09-10
66
Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "[email protected]",
77
comment = c(ORCID = "0000-0001-6419-907X")),

inst/include/RcppArmadillo/config/RcppArmadilloConfig.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@
126126
// only used int32_t -- so we select the shorter representation here.
127127
// Unless int64_t is explicitly required during compilation.
128128
#if !defined(ARMA_64BIT_WORD)
129-
#define ARMA_32BIT_WORD 1
129+
//#define ARMA_32BIT_WORD 1
130+
#define ARMA_64BIT_WORD 1
130131
#endif
131132

132133
// To return arma::vec or arma::rowvec as R vector (i.e. dimensionless),

inst/include/RcppArmadillo/interface/RcppArmadilloAs.h

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,31 @@ namespace traits {
483483
Rcpp::Vector<RTYPE> vec;
484484
};
485485

486-
// specializations for 3 cube typedefs that fail above
487-
// first use viable conversion SEXP -> Cube<other_t>
486+
// specializations for 3 (or 4, see below) cube typedefs that
487+
// fail above first use viable conversion SEXP -> Cube<other_t>
488488
// then use conv_to<cube_t>::from(other_t other)
489+
#ifdef ARMA_64BIT_WORD
490+
// if we use ARMA_64BIT_WORD we cannot pass int through and
491+
// need a fourth specialization similar to the other three
492+
template <>
493+
class Exporter<arma::icube> {
494+
public:
495+
typedef arma::icube cube_t;
496+
497+
Exporter(SEXP x)
498+
: tmp(Exporter<arma::cube>(x).get()) {}
499+
500+
cube_t get() {
501+
cube_t result = arma::conv_to<cube_t>::from(tmp);
502+
return result;
503+
}
504+
505+
private:
506+
typedef arma::cube other_t;
507+
other_t tmp;
508+
};
509+
#endif
510+
489511
template <>
490512
class Exporter<arma::fcube> {
491513
public:

inst/tinytest/test_rng.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ expect_true(max(a) < 1)#, msg="randu max")
5252
set.seed(123)
5353
a <- randi(10)
5454
expect_true(min(a) > 0)#, msg="randi min")
55-
expect_true(typeof(a) == "integer")#, msg="randi type")
55+
## under ARMA_64BIT_WORD we get 'double'
56+
expect_true(typeof(a) == "integer" || typeof(a) == "double")#, msg="randi type")
5657

5758
#test.randn <- function() {
5859
set.seed(123)

0 commit comments

Comments
 (0)