Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Dirk Eddelbuettel
On 15 December 2021 at 12:30, Robert J. Hijmans wrote: | Dirk thanks very much for the help. And sorry, Alex, I misspoke. I meant to | say that Rcpp will coerce a R "numeric" (vector) to an | "Rcpp::IntegerVector" if you ask it to do so (and that is what happened in | the context we were discussin

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Dirk Eddelbuettel
On 15 December 2021 at 20:10, Balamuta, James Joseph wrote: | For those interested, the few other instances can be found by looking under the inst/include/Rcpp/generated/ folder: | | https://github.com/RcppCore/Rcpp/tree/master/inst/include/Rcpp/generated Yup, I mentioned the dir, but thanks f

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Alex Ilich
Thanks Bill. I'm not sure how to set breakpoint on Windows (I found resources for lldb or gdb which seem to be for Linux), but was able to get a bit more insight with your Rf_error line and some print statements. For some reason specifically on the first iteration xw is evaluating to 1:21 (the nu

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Balamuta, James Joseph
For those interested, the few other instances can be found by looking under the inst/include/Rcpp/generated/ folder: https://github.com/RcppCore/Rcpp/tree/master/inst/include/Rcpp/generated In the case of Vector__create.h, one would need to do some varidic templating to abstract away from the

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Dirk Eddelbuettel
On 15 December 2021 at 10:19, Kevin Ushey wrote: | I assume we're talking about Vector::create()? Anyone curious poking at it | can start by looking here: | | https://github.com/RcppCore/Rcpp/blob/940fb23868bf442e587994451e85263baa302d9c/inst/include/Rcpp/vector/Vector.h#L1122-L1126 There is mo

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Kevin Ushey
I assume we're talking about Vector::create()? Anyone curious poking at it can start by looking here: https://github.com/RcppCore/Rcpp/blob/940fb23868bf442e587994451e85263baa302d9c/inst/include/Rcpp/vector/Vector.h#L1122-L1126 On Wed, Dec 15, 2021 at 8:51 AM Dirk Eddelbuettel wrote: > > Joseph,

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Bill Dunlap
To make this easier to debug, I added a check that the values in the x given to C_make_glcm are within bounds: for(int i=0; i < nr; ++i){ for(int j=0; j < nc; ++j){ int focal_val = x(i,j); if (focal_val >= n_levels || focal_val < 0) { // sanity check Rf_error("programme

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Alex Ilich
Thanks, I thought I was onto something there but I guess that wasn't the issue (that only came up because when I made edits to my function to just return the actual values as a check, I was converting them in an unsafe way from int to double). I'm still confused on how the valgrind check Bill was r

Re: [Rcpp-devel] Limit of 20

2021-12-15 Thread Dirk Eddelbuettel
Joseph, Sorry, can't quote your message as whatever you used confused my mail handler. (Maybe try text-only next time if you remeber? I have had this before, albeit very rarely.) But it is a good idea. Someone with a bit of time should sit down and could do this as we now have C++11 / C++14 as

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Dirk Eddelbuettel
On 15 December 2021 at 11:22, Alex Ilich wrote: | I actually think that the issue may be related to conversions between | int/IntegerVectors and double/NumericVector/std::vector. I was | talking with the terra package author to see if the focalCpp function can | take an IntegerVector instead of a

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Alex Ilich
I actually think that the issue may be related to conversions between int/IntegerVectors and double/NumericVector/std::vector. I was talking with the terra package author to see if the focalCpp function can take an IntegerVector instead of a NumericVector/ /std::vector, as it seemed initially to be