Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-13 Thread Alex Ilich
Thanks for digging into this for me. If focal_val is 16, then this is an out of bounds error as the matrix is 16x16 and the maximum index can be 15. What I'm confused about is that focal_val comes from the data which has been transformed to be restricted to integers in the range of 0-15 (0 - n_leve

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Alex Ilich
NA,1)) # -2147483648 On Mon, Dec 13, 2021 at 3:43 PM Alex Ilich wrote: > Thanks for digging into this for me. If focal_val is 16, then this is an > out of bounds error as the matrix is 16x16 and the maximum index can be 15. > What I'm confused about is that focal_val comes from the

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Alex Ilich
tions.cpp R function that calls C++ functions: https://github.com/ailich/GLCMTextures/blob/terra/R/glcm_textures2.R On Wed, Dec 15, 2021 at 11:49 AM Dirk Eddelbuettel wrote: > > On 15 December 2021 at 11:22, Alex Ilich wrote: > | I actually think that the issue may be rela

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-15 Thread Alex Ilich
ng integer vector with values 1:21. C_glcm_textures_helper2 seems to > use this as a C++ subscript -- should it be 0:20? (I did not try to > analyze the code very closely.) > > -Bill > > On Wed, Dec 15, 2021 at 9:26 AM Alex Ilich wrote: > >> Thanks, I thought I was onto someth

Re: [Rcpp-devel] R Session Sometimes Aborts

2021-12-16 Thread Alex Ilich
Thanks everyone for helping me figure this out. Within terra::focalCpp which handles the iteration over small subsets of the data there is a test iteration that occurs which uses the data that is numbers 1-number of elements in the window (for a 3x7 window that'd be 1-21). Since the function I'm us

[Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-28 Thread Alex Ilich
Hi, I have some code I've written to calculate regression parameters using ordinarily least squares using RcppArmadillo. This is meant to be performed iteratively over many small subsets (sliding window over spatial raster data) so I'd like to automatically detect when the regression can't be perfo

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-28 Thread Alex Ilich
meric precision issue Y<- matrix(1:6, ncol=1) C_OLS(X,Y) # 0[1] NA NA NA C_OLS(X2,Y) # 0[1] NA NA NA On Fri, Jan 28, 2022 at 11:53 AM Alex Ilich wrote: > Hi, I have some code I've written to calculate regression parameters using > ordinarily least squares using RcppArmadillo.

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-28 Thread Alex Ilich
Thanks! I'll use if(rcf <= std::numeric_limits::epsilon()) instead of rcf==0. On Fri, Jan 28, 2022 at 7:32 PM Dirk Eddelbuettel wrote: > > On 28 January 2022 at 13:25, Alex Ilich wrote: > | Thank you Neal and Dirk. Based on these comments I think using > arma::rcond &g

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-30 Thread Alex Ilich
use if(rcf <= std::numeric_limits::epsilon()) >> instead of rcf==0. >> >> On Fri, Jan 28, 2022 at 7:32 PM Dirk Eddelbuettel wrote: >> >>> >>> On 28 January 2022 at 13:25, Alex Ilich wrote: >>> | Thank you Neal and Dirk. Based on these comments I

Re: [Rcpp-devel] Detecting Singular Matrices in RcppArmadillo

2022-01-31 Thread Alex Ilich
Thank you Zé and Dirk! That helped clarify exactly what solve is doing which I was having trouble tracking down in just the standard docs page. On Sun, Jan 30, 2022 at 11:26 PM Zé Vinícius wrote: > Very interesting, Dirk. Thanks! > > On Mon, Jan 31, 2022 at 12:18 PM Dirk Eddelbuettel wrote: > >