Can you prepare a reprex ?
> Le 2 juin 2017 à 15:40, "f.k...@mailbox.org" <f.k...@mailbox.org> a écrit : > > Hi all, > > I wrote a function foo using RcppParallel and I am observing a bug, which I > can’t figure out. > I first wrote the function in R, then in Rcpp, then RcppParallel. > > foo is doing exactly what it is supposed to do in R and Rcpp. > However, I am observing some wired things in RcppParallel. > > foo_par is running, giving almost what I want. > > foo compares two matrices columnwise all pairwise combinations. > thus we have 3 loops. > In the smallest step it takes two values e.g. m[c(row1, row2), 1] from the > first matrix and checks if they are > appear in 1 column in the second matrix. If they are 1 is returned, if not 0. > > However, before that there is a check if one of the c(1,2) is even, then only > a NA is returned. > Check below for this step. > > The wired thing is, that this works perfectly fine the very 1st instance this > case happens > and not any more in the thereafter examples. > > E.g: > > > foo(m1, m2) > [,1] [,2] [,3] [,4] > [1,] 1 1 1 1 > [2,] 1 NA 1 0* > [3,] 1 0* 1 0* > > the 0s with * should be NA. > > > > if ( (row1 % 2 == 0) || (row2 % 2 == 0) ){ > > result_matrix(count, col) = NA_REAL; > > } else { > > do the 0, 1 stuff > } > > ** count: i am using a counter for the filling of the resulting matrix > (indicates the row where it should be put) > ** col: this is from the outest loop. it loops over columns and then writes > the result into the according col in the result matrix. > > > > Is this enough information? > If someone needs to see the full function, I would prefer to send this via > mail directly, since > this is for a publication… > > I appreciate any hints! > And I am wondering if this is coming from the parallelization itself? > The modulo is somehow not working correctly? > > Cheers, > Franz > _______________________________________________ > 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
_______________________________________________ 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