On 16 October 2014 at 08:35, Dirk Eddelbuettel wrote: | | | On 16 October 2014 at 15:07, Henrik Singmann wrote: | | Hi Dirk and Kevin, | | | | I have now rebuild the package using the code Dirk send me (i.e., using attributes) and the code still reliably crashes my R on Linux when using devtools (independent of RStudio), but not when installing via install.packages. When just using the code Dirk had send directly (i.e., outside a package) this does not happen. | | Please take that up with the devtools maintainer. I do not use devtools.
And FWIW he used confirmed over IM that devtools sets NDEBUG. So there -- devtools issues, not an Rcpp or RcppEigen issue. Dirk | It is not part of what we asked for: __a minimally reproducible example__ | | | Note that I had to minimally change the code Dirk had sent as I couldn't manage to use "using Eigen::" so had to preface every call to Eigen functions or structures with "Eigen::". | | Here is my counter example. Ubuntu 14.04. Everything current. | | Save the following a file "henrik.cpp" | | ----------------------------------------------------------------------------- | | #include <RcppEigen.h> | | using namespace Rcpp; | | using Eigen::Map; | using Eigen::VectorXd; | using Eigen::RowVectorXd; | using Eigen::MatrixXd; | | // [[Rcpp::depends(RcppEigen)]] | | // The following is __identical__ to mptmin::src/determinant.cpp | // but at the same time much, much shorter and more readable | // | // The following 'tag' ensure determinant2() is accessible from R | // | // [[Rcpp::export]] | int determinant2(int S, Map<MatrixXd> Ineq) { | | VectorXd thetaTMP = Rcpp::as<VectorXd>(rbeta(S, 0.5, 0.5)); | RowVectorXd theta = thetaTMP.transpose(); | | VectorXd IneqT = (theta*Ineq.transpose()); | | return 0; | } | | /*** R | | # the following is equivalent to mptmin::R/minimal.cpp | # but shorter and easier; also removed the leading dot | oneSample2 <- function(Sx, Ineq) { | #.Call("determinant2", Sx, Ineq, PACKAGE = "MPTbug") | determinant2(Sx, Ineq) | } | | # the dimensions are of course incompatible so this is user error | trigger <- function() { | S <- 3 | # why would you create a matrix via structure() ? | Ineq <- structure(0, .Dim = c(1L, 1L)) #error | oneSample2(Sx = S, Ineq = Ineq) | } | | no_trigger <- function() { | S <- 3 | Ineq <- structure(c(-1, 1, 0), .Dim = c(1L, 3L)) # no error | oneSample2(Sx = S, Ineq = Ineq) | } | | no_trigger() # no issue | trigger() # no issue either | */ | | ----------------------------------------------------------------------------- | | | In an R session, issue the following command sourceCpp("filename.cpp") with | the name (plus optional path) to the file above. Here is what I get in a | fresh session: | | ----------------------------------------------------------------------------- | R> Rcpp::sourceCpp("~/Dropbox/tmp/henrik.cpp") | | R> # the following is equivalent to mptmin::R/minimal.cpp | R> # but shorter and easier; also removed the leading dot | R> oneSample2 <- function(Sx, In .... [TRUNCATED] | | R> # the dimensions are of course incompatible so this is user error | R> trigger <- function() { | + S <- 3 | + # why would you create a matrix via str .... [TRUNCATED] | | R> no_trigger <- function() { | + S <- 3 | + Ineq <- structure(c(-1, 1, 0), .Dim = c(1L, 3L)) # no error | + oneSample2(Sx = S, Ineq = Ineq) | + } | | R> no_trigger() # no issue | [1] 0 | | R> trigger() # no issue either | [1] 0 | R> | ----------------------------------------------------------------------------- | | I consider this issue closed because __there is still no minimal reproducible | bug__. | | There is what we could call a user error. Or if you wish a design error. You | simply cannot multiply non-conformant vectors. | | Dirk | | | | | | | | -- | http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel