From g.vegayon at gmail.com Tue May 3 19:17:47 2016 From: g.vegayon at gmail.com (George Vega Yon) Date: Tue, 3 May 2016 10:17:47 -0700 Subject: [Rcpp-devel] Overriding 'ARMA_64BIT_WORD 1' in RcppArmadillo In-Reply-To: References: <22269.31874.951055.621935@max.nulle.part> Message-ID: I think I've found a solution for this. I've submitted a pull request here https://github.com/RcppCore/RcppArmadillo/pull/88. It basically now allows the users to pass -DARMA_64BIT_WORD and compile with it (so ARMA_32BIT_WORD is not defined but it is still the default behavior of RcppArmadillo). Will work on tests on this repo https://github.com/gvegayon/arma64bit. Best, George G. Vega Yon +1 (626) 381 8171 http://www.its.caltech.edu/~gvegayon/ On Thu, Apr 28, 2016 at 6:07 PM, George Vega Yon wrote: > Hey! > > Since it seems to be the case that we don't know much about what happens, > I'm making an experiment which consists on an R package to stress > RcppArmadillo here: https://github.com/gvegayon/arma64bit. Following > Dirk's advice, I've included the #define ARMA_64BIT_WORD before #include > (as seen here > https://github.com/gvegayon/arma64bit/blob/c10b5d4a80b93088da730e45ee8c583feeff2ab6/src/misc.cpp#L2-L3) > and included CXX_STD = CXX11 in Makevars. After compiling the package and > asking for a matrix of size 1e5 x 1e5 I get an error, here (so it doesn't > seem to be working): > > > x <- sp_runif(1e5,1e5,.01) > > error: SpMat::init(): requested size is too large > Error: SpMat::init(): requested size is too large > > My guess is that #define ARMA_32BIT_WORD is overriding #define > ARMA_64BIT_WORD. I'm an R user that jumped to Rcpp a while ago so I still > don't fully understand how things work under the hood with R + Rcpp. Any > clues? > > Best, > > sessionInfo() > > R version 3.2.5 (2016-04-14) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Ubuntu 14.04.4 LTS > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > LC_TIME=en_US.UTF-8 > [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 > LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C > > [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 > LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] arma64bit_0.1.0.9000 Matrix_1.2-5 > > loaded via a namespace (and not attached): > [1] Rcpp_0.12.4 lattice_0.20-33 digest_0.6.9 withr_1.0.1 > grid_3.2.5 > [6] covr_2.0.1 git2r_0.14.0 magrittr_1.5 lazyeval_0.1.10 > rstudioapi_0.5 > [11] whisker_0.3-2 rex_1.1.1 rmarkdown_0.9.5 devtools_1.11.1 > tools_3.2.5 > [16] yaml_2.1.13 htmltools_0.3.5 memoise_1.0.0 > > George G. Vega Yon > +1 (626) 381 8171 > http://www.its.caltech.edu/~gvegayon/ > > On Thu, Mar 31, 2016 at 12:37 PM, Dirk Eddelbuettel > wrote: > >> >> On 29 March 2016 at 15:55, George Vega Yon wrote: >> | Hi there, >> | >> | A couple of days ago I included this comment on a Stackoverflow >> question about >> | "too large" matrices in RcppArmadillo >> | I wonder if we can use this in a package. After trying to compile the >> package >> | with and without PKG_CXXFLAGS=-DARMA_64BIT_WORD I'm still not able to >> create >> | sparse matrices bigger than 65,535 x 65,535. I've realized that the >> | RcppArmadilloConfig.h (version 0.6.600.4.0) file has ARMA_32BIT_WORD 1 >> so it >> | actually prevents using ARMA_64BIT_WORD (I think?). Any way I can solve >> this, >> | or I just have to deal with R (3.2.4 Revised (2016-03-16 r70336)) not >> been able >> | to handle 64INT? >> | >> | http://stackoverflow.com/questions/16159174/ >> | large-spmat-object-with-rcpparmadillo >> | >> | For which Dirk answered: >> | >> | Try locally setting ARMA_64BIT_WORD (check how) -- I can't at the >> package level >> | as it breaks existing code. It will likely help you. If you set it >> before the # >> | include things may just work. That at least is the >> pln. (And >> | you should have asked on rcpp-devel to get more than two eyeballs on >> this...) >> | And yes the other answer basically says the same thing. ? Dirk >> Eddelbuettel 2 >> | days ago >> | >> | Now I'm asking again but on rcpp-devel =). The issue is that I'm >> concerned on >> | the part that Dirk says that "things may just work". I was reading >> about R not >> | been able to handle int64 and its implications for big matrices, and so >> I'm a >> | little concerned that if passing ARMA_64BIT_WORD works I may loose some >> | information on the way. For example, if I allow a users creating and >> | manipulating 1e6 x 1e6 sparse matrices, is there any chance for them to >> loose >> | information? >> >> It is entirely possibly that nobody stresses RcppArmadillo this way and >> that >> setting ARMA_64BIT_WORD gets unset. I only know that I cannot set it >> globally now as some packages (still) depend on ARMA_32BIT_WORD. >> >> So I encourage you to experiment and to try locally. Maybe something can >> (and even should) be improved. >> >> Dirk >> >> >> | >> | Thanks, >> | >> | George G. Vega Yon >> | +1 (626) 381 8171 >> | http://www.its.caltech.edu/~gvegayon/ >> | _______________________________________________ >> | Rcpp-devel mailing list >> | Rcpp-devel at lists.r-forge.r-project.org >> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel >> >> -- >> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Tue May 3 19:48:29 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 3 May 2016 12:48:29 -0500 Subject: [Rcpp-devel] Overriding 'ARMA_64BIT_WORD 1' in RcppArmadillo In-Reply-To: References: <22269.31874.951055.621935@max.nulle.part> Message-ID: <22312.58477.132043.200@max.nulle.part> Hi George, On 3 May 2016 at 10:17, George Vega Yon wrote: | I think I've found a solution for this. I've submitted a pull request here | https://github.com/RcppCore/RcppArmadillo/pull/88. It basically now allows the | users to pass -DARMA_64BIT_WORD and compile with it (so ARMA_32BIT_WORD is not | defined but it is still the default behavior of RcppArmadillo). Will work on | tests on this repo?https://github.com/gvegayon/arma64bit. The pull request looks good. I know this issue had been bugging you for a while (and I am really glad we seem to be having a solution for you !!) but do you recall if I posted here _which_ packages failed when Conrad started to default to ARMA_64BIT_WORD under C++11 ? Dirk | | Best, | | George G. Vega Yon | +1 (626) 381 8171 | http://www.its.caltech.edu/~gvegayon/ | | On Thu, Apr 28, 2016 at 6:07 PM, George Vega Yon wrote: | | Hey! | | Since it seems to be the case that we don't know much about what happens, | I'm making an experiment which consists on an R package to stress | RcppArmadillo here:?https://github.com/gvegayon/arma64bit. Following Dirk's | advice, I've included the #define ARMA_64BIT_WORD before #include | (as seen here?https://github.com/gvegayon/arma64bit/blob/ | c10b5d4a80b93088da730e45ee8c583feeff2ab6/src/misc.cpp#L2-L3) and | included?CXX_STD = CXX11 in Makevars. After compiling the package and | asking for a matrix of size 1e5 x 1e5 I get an error, here (so it doesn't | seem to be working): | | > x <- sp_runif(1e5,1e5,.01) | | error: SpMat::init(): requested size is too large | Error: SpMat::init(): requested size is too large | | My guess is that #define ARMA_32BIT_WORD is overriding #define | ARMA_64BIT_WORD. I'm an R user that jumped to Rcpp a while ago so I still | don't fully understand how things work under the hood with R + Rcpp. Any | clues? | | Best, | | sessionInfo() | | R version 3.2.5 (2016-04-14) | Platform: x86_64-pc-linux-gnu (64-bit) | Running under: Ubuntu 14.04.4 LTS | | locale: | ?[1] LC_CTYPE=en_US.UTF-8 ? ? ? LC_NUMERIC=C ? ? ? ? ? ? ? LC_TIME= | en_US.UTF-8 ? ? ?? | ?[4] LC_COLLATE=en_US.UTF-8 ? ? LC_MONETARY=en_US.UTF-8 ? ?LC_MESSAGES= | en_US.UTF-8 ?? | ?[7] LC_PAPER=en_US.UTF-8 ? ? ? LC_NAME=C ? ? ? ? ? ? ? ? ?LC_ADDRESS=C ? ? | ? ? ? ? ? | [10] LC_TELEPHONE=C ? ? ? ? ? ? LC_MEASUREMENT=en_US.UTF-8 | LC_IDENTIFICATION=C ? ? ?? | | attached base packages: | [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base ? ?? | | other attached packages: | [1] arma64bit_0.1.0.9000 Matrix_1.2-5 ? ? ? ? | | loaded via a namespace (and not attached): | ?[1] Rcpp_0.12.4 ? ? lattice_0.20-33 digest_0.6.9 ? ?withr_1.0.1 ? ? | grid_3.2.5 ? ?? | ?[6] covr_2.0.1 ? ? ?git2r_0.14.0 ? ?magrittr_1.5 ? ?lazyeval_0.1.10 | rstudioapi_0.5? | [11] whisker_0.3-2 ? rex_1.1.1 ? ? ? rmarkdown_0.9.5 devtools_1.11.1 | tools_3.2.5 ? ? | [16] yaml_2.1.13 ? ? htmltools_0.3.5 memoise_1.0.0 ? | | George G. Vega Yon | +1 (626) 381 8171 | http://www.its.caltech.edu/~gvegayon/ | | On Thu, Mar 31, 2016 at 12:37 PM, Dirk Eddelbuettel wrote: | | | On 29 March 2016 at 15:55, George Vega Yon wrote: | | Hi there, | | | | A couple of days ago I included this comment on a Stackoverflow | question about | | "too large" matrices in RcppArmadillo | | I wonder if we can use this in a package. After trying to compile the | package | | with and without PKG_CXXFLAGS=-DARMA_64BIT_WORD I'm still not able to | create | | sparse matrices bigger than 65,535 x 65,535. I've realized that the | | RcppArmadilloConfig.h (version 0.6.600.4.0) file has ARMA_32BIT_WORD | 1 so it | | actually prevents using ARMA_64BIT_WORD (I think?). Any way I can | solve this, | | or I just have to deal with R (3.2.4 Revised (2016-03-16 r70336)) not | been able | | to handle 64INT? | | | | http://stackoverflow.com/questions/16159174/ | | large-spmat-object-with-rcpparmadillo | | | | For which Dirk answered: | | ? | | Try locally setting ARMA_64BIT_WORD (check how) -- I can't at the | package level | | as it breaks existing code. It will likely help you. If you set it | before the # | | include things may just work. That at least is the | pln. (And | | you should have asked on rcpp-devel to get more than two eyeballs on | this...) | | And yes the other answer basically says the same thing. ? Dirk | Eddelbuettel 2 | | days ago | | | | Now I'm asking again but on rcpp-devel =). The issue is that I'm | concerned on | | the part that Dirk says that "things may just work". I was reading | about R not | | been able to handle int64 and its implications for big matrices, and | so I'm a | | little concerned that if passing ARMA_64BIT_WORD works I may loose | some | | information on the way. For example, if I allow a users creating and | | manipulating 1e6 x 1e6 sparse matrices, is there any chance for them | to loose | | information? | | It is entirely possibly that nobody stresses RcppArmadillo this way and | that | setting ARMA_64BIT_WORD gets unset.? ?I only know that I cannot set it | globally now as some packages (still) depend on ARMA_32BIT_WORD. | | So I encourage you to experiment and to try locally.? Maybe something | can | (and even should) be improved. | | Dirk | | | | | | Thanks, | | | | George G. Vega Yon | | +1 (626) 381 8171 | | http://www.its.caltech.edu/~gvegayon/ | | _______________________________________________ | | Rcpp-devel mailing list | | Rcpp-devel at lists.r-forge.r-project.org | | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/ | rcpp-devel | | -- | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | | | | -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From g.vegayon at gmail.com Tue May 3 20:54:17 2016 From: g.vegayon at gmail.com (George Vega Yon) Date: Tue, 3 May 2016 11:54:17 -0700 Subject: [Rcpp-devel] Overriding 'ARMA_64BIT_WORD 1' in RcppArmadillo In-Reply-To: <22312.58477.132043.200@max.nulle.part> References: <22269.31874.951055.621935@max.nulle.part> <22312.58477.132043.200@max.nulle.part> Message-ID: I was about to ask you the same question =S. The only thing that I found was this http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-November/006827.html. Can't find anything else in google, RcppArmadillo/issues or the rcpp-devel. Thanks! George G. Vega Yon +1 (626) 381 8171 http://www.its.caltech.edu/~gvegayon/ On Tue, May 3, 2016 at 10:48 AM, Dirk Eddelbuettel wrote: > > Hi George, > > On 3 May 2016 at 10:17, George Vega Yon wrote: > | I think I've found a solution for this. I've submitted a pull request > here > | https://github.com/RcppCore/RcppArmadillo/pull/88. It basically now > allows the > | users to pass -DARMA_64BIT_WORD and compile with it (so ARMA_32BIT_WORD > is not > | defined but it is still the default behavior of RcppArmadillo). Will > work on > | tests on this repo https://github.com/gvegayon/arma64bit. > > The pull request looks good. I know this issue had been bugging you for a > while (and I am really glad we seem to be having a solution for you !!) but > do you recall if I posted here _which_ packages failed when Conrad started > to > default to ARMA_64BIT_WORD under C++11 ? > > Dirk > > | > | Best, > | > | George G. Vega Yon > | +1 (626) 381 8171 > | http://www.its.caltech.edu/~gvegayon/ > | > | On Thu, Apr 28, 2016 at 6:07 PM, George Vega Yon > wrote: > | > | Hey! > | > | Since it seems to be the case that we don't know much about what > happens, > | I'm making an experiment which consists on an R package to stress > | RcppArmadillo here: https://github.com/gvegayon/arma64bit. > Following Dirk's > | advice, I've included the #define ARMA_64BIT_WORD before #include > | (as seen here > https://github.com/gvegayon/arma64bit/blob/ > | c10b5d4a80b93088da730e45ee8c583feeff2ab6/src/misc.cpp#L2-L3) and > | included CXX_STD = CXX11 in Makevars. After compiling the package and > | asking for a matrix of size 1e5 x 1e5 I get an error, here (so it > doesn't > | seem to be working): > | > | > x <- sp_runif(1e5,1e5,.01) > | > | error: SpMat::init(): requested size is too large > | Error: SpMat::init(): requested size is too large > | > | My guess is that #define ARMA_32BIT_WORD is overriding #define > | ARMA_64BIT_WORD. I'm an R user that jumped to Rcpp a while ago so I > still > | don't fully understand how things work under the hood with R + Rcpp. > Any > | clues? > | > | Best, > | > | sessionInfo() > | > | R version 3.2.5 (2016-04-14) > | Platform: x86_64-pc-linux-gnu (64-bit) > | Running under: Ubuntu 14.04.4 LTS > | > | locale: > | [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME= > | en_US.UTF-8 > | [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 > LC_MESSAGES= > | en_US.UTF-8 > | [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > LC_ADDRESS=C > | > | [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 > | LC_IDENTIFICATION=C > | > | attached base packages: > | [1] stats graphics grDevices utils datasets methods base > > | > | other attached packages: > | [1] arma64bit_0.1.0.9000 Matrix_1.2-5 > | > | loaded via a namespace (and not attached): > | [1] Rcpp_0.12.4 lattice_0.20-33 digest_0.6.9 withr_1.0.1 > | grid_3.2.5 > | [6] covr_2.0.1 git2r_0.14.0 magrittr_1.5 lazyeval_0.1.10 > | rstudioapi_0.5 > | [11] whisker_0.3-2 rex_1.1.1 rmarkdown_0.9.5 devtools_1.11.1 > | tools_3.2.5 > | [16] yaml_2.1.13 htmltools_0.3.5 memoise_1.0.0 > | > | George G. Vega Yon > | +1 (626) 381 8171 > | http://www.its.caltech.edu/~gvegayon/ > | > | On Thu, Mar 31, 2016 at 12:37 PM, Dirk Eddelbuettel > wrote: > | > | > | On 29 March 2016 at 15:55, George Vega Yon wrote: > | | Hi there, > | | > | | A couple of days ago I included this comment on a Stackoverflow > | question about > | | "too large" matrices in RcppArmadillo > | | I wonder if we can use this in a package. After trying to > compile the > | package > | | with and without PKG_CXXFLAGS=-DARMA_64BIT_WORD I'm still not > able to > | create > | | sparse matrices bigger than 65,535 x 65,535. I've realized > that the > | | RcppArmadilloConfig.h (version 0.6.600.4.0) file has > ARMA_32BIT_WORD > | 1 so it > | | actually prevents using ARMA_64BIT_WORD (I think?). Any way I > can > | solve this, > | | or I just have to deal with R (3.2.4 Revised (2016-03-16 > r70336)) not > | been able > | | to handle 64INT? > | | > | | http://stackoverflow.com/questions/16159174/ > | | large-spmat-object-with-rcpparmadillo > | | > | | For which Dirk answered: > | | > | | Try locally setting ARMA_64BIT_WORD (check how) -- I can't at > the > | package level > | | as it breaks existing code. It will likely help you. If you > set it > | before the # > | | include things may just work. That at least > is the > | pln. (And > | | you should have asked on rcpp-devel to get more than two > eyeballs on > | this...) > | | And yes the other answer basically says the same thing. ? Dirk > | Eddelbuettel 2 > | | days ago > | | > | | Now I'm asking again but on rcpp-devel =). The issue is that > I'm > | concerned on > | | the part that Dirk says that "things may just work". I was > reading > | about R not > | | been able to handle int64 and its implications for big > matrices, and > | so I'm a > | | little concerned that if passing ARMA_64BIT_WORD works I may > loose > | some > | | information on the way. For example, if I allow a users > creating and > | | manipulating 1e6 x 1e6 sparse matrices, is there any chance > for them > | to loose > | | information? > | > | It is entirely possibly that nobody stresses RcppArmadillo this > way and > | that > | setting ARMA_64BIT_WORD gets unset. I only know that I cannot > set it > | globally now as some packages (still) depend on ARMA_32BIT_WORD. > | > | So I encourage you to experiment and to try locally. Maybe > something > | can > | (and even should) be improved. > | > | Dirk > | > | > | | > | | Thanks, > | | > | | George G. Vega Yon > | | +1 (626) 381 8171 > | | http://www.its.caltech.edu/~gvegayon/ > | | _______________________________________________ > | | Rcpp-devel mailing list > | | Rcpp-devel at lists.r-forge.r-project.org > | | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/ > | rcpp-devel > | > | -- > | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > | > | > | > | > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sun May 8 15:14:01 2016 From: teuder at gmail.com (=?utf-8?B?5rSl55Sw55yf5qi5?=) Date: Sun, 8 May 2016 22:14:01 +0900 Subject: [Rcpp-devel] Bug: replace_last() Message-ID: I find a bug in String::replace_last(). I can reproduce the bug with the following code. (I also showed output of replace_first and replace_all for comparison.) ============= // [[Rcpp::export]] void rcpp_string(){ String s("abcdabcd"); Rcout << "replace_first()\n"; Rcout << s.replace_first("ab", "AB").get_cstring() << "\n"; Rcout << "\n"; s="abcdabcd"; Rcout << "replace_last()\n"; Rcout << s.replace_last("ab", "AB").get_cstring() << "\n"; Rcout << "\n"; s="abcdabcd"; Rcout << "replace_all()\n"; Rcout << s.replace_all("ab", "AB").get_cstring() << "\n"; Rcout << "\n"; } ============= output ============= replace_first() ABcdabcd replace_last() abcdaABd replace_all() ABcdABcd ============= I also tried to fix the bug with following code. And the bug seems to be fixed. ============= inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); //size_t index = buffer.find_last_of(s); size_t index = buffer.find_last_of(s) - (strlen(s)-1); Rcout << "A" << index << "\n"; if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ============= output ============= replace_first() ABcdabcd replace_last() abcdABcd replace_all() ABcdABcd ============= Mac OS 10.10.5 R version 3.2.3 Rcpp 0.12.4 From robi.ragan at sjsu.edu Thu May 12 22:56:31 2016 From: robi.ragan at sjsu.edu (Robi Ragan) Date: Thu, 12 May 2016 13:56:31 -0700 Subject: [Rcpp-devel] Compiler [-Wunused-variable] warnings. In-Reply-To: References: <22269.31874.951055.621935@max.nulle.part> <22312.58477.132043.200@max.nulle.part> Message-ID: <3F4836C5-1420-4E05-9247-45FE39C41950@sjsu.edu> On compilation I am getting lots of warnings that I would love to resolve. There are 30 or so but they all more or less look like the first three ill paste here: > ==> R CMD INSTALL --preclean --no-multiarch --with-keep.source voteR > > * installing to library ?/Library/Frameworks/R.framework/Versions/3.3/Resources/library? > * installing *source* package ?voteR? ... > ** libs > clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include" -fPIC -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o > RcppExports.cpp:14:1: warning: unused variable 'rcpp_output_type' [-Wunused-variable] > BEGIN_RCPP > ^ > /Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/macros/macros.h:31:9: note: expanded from macro 'BEGIN_RCPP' > int rcpp_output_type = 0 ; \ > ^ > RcppExports.cpp:14:1: warning: unused variable 'rcpp_output_condition' [-Wunused-variable] > /Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/macros/macros.h:32:10: note: expanded from macro 'BEGIN_RCPP' > SEXP rcpp_output_condition = R_NilValue ; \ > ^ > RcppExports.cpp:49:1: warning: unused variable 'rcpp_output_type' [-Wunused-variable] > BEGIN_RCPP > ^ > /Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include/Rcpp/macros/macros.h:31:9: note: expanded from macro 'BEGIN_RCPP' > int rcpp_output_type = 0 ; \ > ^ I tried searching all the relevant places for the past week or so and came up with no suggestions I could get to work. IF anyone can point me in the right direction I would appreciate it. If more of the output is needed I can provide it, I just wanted to keep the message as short as possible. Thanks, Robi Ragan Assistant Professor of Economics College of Social Sciences San Jose State University http://www.robiragan.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 13:20:52 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 20:20:52 +0900 Subject: [Rcpp-devel] Bug report : String::replace_first(), String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 14:57:27 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 21:57:27 +0900 Subject: [Rcpp-devel] Bug report : replace_first() and replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 15:08:38 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 22:08:38 +0900 Subject: [Rcpp-devel] Bug report : String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 15:15:46 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 22:15:46 +0900 Subject: [Rcpp-devel] Bug report : replace_first() and replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 15:25:17 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 22:25:17 +0900 Subject: [Rcpp-devel] Bug report : String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 15:36:46 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 22:36:46 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 15:47:05 2016 From: teuder at gmail.com (=?utf-8?B?5rSl55Sw55yf5qi5?=) Date: Sat, 14 May 2016 22:47:05 +0900 Subject: [Rcpp-devel] Bug report : String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From teuder at gmail.com Sat May 14 16:12:11 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 23:12:11 +0900 Subject: [Rcpp-devel] Bug report : String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From teuder at gmail.com Sat May 14 16:35:23 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sat, 14 May 2016 23:35:23 +0900 Subject: [Rcpp-devel] Bug report : String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sat May 14 16:42:56 2016 From: teuder at gmail.com (=?utf-8?B?5rSl55Sw55yf5qi5?=) Date: Sat, 14 May 2016 23:42:56 +0900 Subject: [Rcpp-devel] Bug report : String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions by find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards From teuder at gmail.com Sun May 15 03:34:26 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sun, 15 May 2016 10:34:26 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: <5F59F213-690F-4735-B0A1-0DA4EA506480@gmail.com> Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From teuder at gmail.com Sun May 15 04:42:30 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sun, 15 May 2016 11:42:30 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: <6E563C1D-6DC8-4993-92ED-80D83A417AAD@gmail.com> Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From teuder at gmail.com Sun May 15 06:07:28 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sun, 15 May 2016 13:07:28 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sun May 15 06:32:50 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sun, 15 May 2016 13:32:50 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: <71ECF08B-E58D-4DFC-AAF7-146A508197A1@gmail.com> Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From teuder at gmail.com Sun May 15 12:18:53 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sun, 15 May 2016 19:18:53 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: <8DE02873-500D-42FE-96E8-2355A1B2ECCA@gmail.com> Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From teuder at gmail.com Sun May 15 15:20:03 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sun, 15 May 2016 22:20:03 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sun May 15 15:23:58 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Sun, 15 May 2016 22:23:58 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first and String::replace_last Message-ID: <85376A86-73BE-49D2-88D3-CB383E38031B@gmail.com> Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From teuder at gmail.com Sun May 15 17:12:20 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Mon, 16 May 2016 00:12:20 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Sun May 15 17:19:08 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Mon, 16 May 2016 00:19:08 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() Message-ID: <2830E201-5537-42E5-B566-FC90062E085D@gmail.com> Hello, all This is my first post to this mailing list. I might have found bugs with String::replace_first() and String::replace_last(). The bugs can be reproduced by following code. (R version 3.2.3 Rcpp 0.12.4) ------------------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() abBCDABCDA replace_last() AABCDABCDab ------------------- The problem is caused by find_first_of() and find_last_of() and it can be resolved by replacing these functions to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com From edd at debian.org Sun May 15 19:21:41 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Sun, 15 May 2016 12:21:41 -0500 Subject: [Rcpp-devel] [ANN] Rcpp 0.12.4 Message-ID: <22328.45093.959632.309311@max.nulle.part> Rcpp 0.12.5 arrived on CRAN yesterday, and I wrote the usual short blog post which it is at http://dirk.eddelbuettel.com/blog/ http://dirk.eddelbuettel.com/blog/2016/05/14#rcpp_0.12.5 and included as text (without links) below. This release once again continues on the 'every two month' release cycle and once again brings a number of fixes including three (by my count) from first-time contributors. Good work by all, and big, big thanks again to everybody for ideas, suggestions, bug fixes, issue tickets and of course well-written pull requests. On behalf of Rcpp Core, Dirk Sat, 14 May 2016 Rcpp 0.12.5: Yet another one The fifth update in the 0.12.* series of Rcpp has arrived on the CRAN network for GNU R a few hours ago, and was just pushed to Debian. This 0.12.5 release follows the 0.12.0 release from late July, the 0.12.1 release in September, the 0.12.2 release in November, the 0.12.3 release in January, and the 0.12.4 release in March --- making it the ninth release at the steady bi-montly release frequency. This release is one again more of a maintenance release addressing a number of small bugs, nuisances or documentation issues without adding any major new features. Rcpp has become the most popular way of enhancing GNU R with C or C++ code. As of today, 662 packages on CRAN depend on Rcpp for making analytical code go faster and further. That is up by almost fifty packages from the last release in late March! And as during the last few releases, we have first-time committers. we have new first-time contributors. Sergio Marques helped to enable compilation on Alpine Linux (with its smaller libc variant). Qin Wenfeng helped adapt for Windows builds under R 3.3.0 and the long-awaited new toolchain. Ben Goodrich fixed a (possibly ancient) Rcpp Modules bug he encountered when working with rstan. Other (recurrent) contributor Dan Dillon cleaned up an issue with Nullable and strings. Rcpp Core team members Kevin and JJ took care of small build nuisance on Windows, and I added in a new helper function, updated the skeleton generator and (finally) formally deprecated loadRcppModule() for which loadModule() has been preferred since around R 2.15 or so. More details and links are below. Changes in Rcpp version 0.12.5 (2016-05-14) * Changes in Rcpp API: * The checks for different C library implementations now also check for Musl used by Alpine Linux (Sergio Marques in PR #449). * Rcpp::Nullable works better with Rcpp::String (Dan Dillon in PR #453). * Changes in Rcpp Attributes: * R 3.3.0 Windows with Rtools 3.3 is now supported (Qin Wenfeng in PR #451). * Correct handling of dependent file paths on Windows (use winslash = "/"). * Changes in Rcpp Modules: * An apparent race condition in Module loading seen with R 3.3.0 was fixed (Ben Goodrich in #461 fixing #458). * The (older) loadRcppModules() is now deprecated in favour of loadModule() introduced around R 2.15.1 and Rcpp 0.9.11 (PR #470). * Changes in Rcpp support functions: * The Rcpp.package.skeleton() function was again updated in order to create a DESCRIPTION file which passes R CMD check without notes. warnings, or error under R-release and R-devel (PR #471). * A new function compilerCheck can test for minimal g++ versions (PR #474). Thanks to CRANberries, you can also look at a diff to the previous release. As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads page, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. This post by Dirk Eddelbuettel originated on his Thinking inside the box blog. Please report excessive re-aggregation in third-party for-profit settings. /code/rcpp | permanent link -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From qkou at umail.iu.edu Mon May 16 20:04:28 2016 From: qkou at umail.iu.edu (Qiang Kou) Date: Mon, 16 May 2016 14:04:28 -0400 Subject: [Rcpp-devel] Bug: replace_last() In-Reply-To: References: Message-ID: Hi, I have confirmed the bug and fix. Please send a PR. We will really appreciate this. Best wishes, KK On Sun, May 8, 2016 at 9:14 AM, ???? wrote: > I find a bug in String::replace_last(). > > I can reproduce the bug with the following code. > (I also showed output of replace_first and replace_all for comparison.) > > > ============= > // [[Rcpp::export]] > void rcpp_string(){ > > String s("abcdabcd"); > Rcout << "replace_first()\n"; > Rcout << s.replace_first("ab", "AB").get_cstring() << "\n"; > Rcout << "\n"; > > s="abcdabcd"; > Rcout << "replace_last()\n"; > Rcout << s.replace_last("ab", "AB").get_cstring() << "\n"; > Rcout << "\n"; > > s="abcdabcd"; > Rcout << "replace_all()\n"; > Rcout << s.replace_all("ab", "AB").get_cstring() << "\n"; > Rcout << "\n"; > } > ============= > > output > ============= > replace_first() > ABcdabcd > > replace_last() > abcdaABd > > replace_all() > ABcdABcd > ============= > > > I also tried to fix the bug with following code. And the bug seems to be > fixed. > > ============= > inline String& replace_last(const char* s, const char* news) { > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const > char* = '%s')", s, news); > if (is_na()) return *this; > setBuffer(); > //size_t index = buffer.find_last_of(s); > size_t index = buffer.find_last_of(s) - (strlen(s)-1); > Rcout << "A" << index << "\n"; > if (index != std::string::npos) buffer.replace(index, strlen(s), news); > valid = false; > return *this; > } > ============= > > output > ============= > replace_first() > ABcdabcd > > replace_last() > abcdABcd > > replace_all() > ABcdABcd > ============= > > > Mac OS 10.10.5 > R version 3.2.3 > Rcpp 0.12.4 > > > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > -- Qiang Kou qkou at umail.iu.edu School of Informatics and Computing, Indiana University -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevinushey at gmail.com Mon May 16 20:04:51 2016 From: kevinushey at gmail.com (Kevin Ushey) Date: Mon, 16 May 2016 11:04:51 -0700 Subject: [Rcpp-devel] Bug: replace_last() In-Reply-To: References: Message-ID: Thanks -- it looks to me like there is something more fundamentally wrong with the 'replace_first' and 'replace_last' methods; ie, I don't think we want to be using 'find_first_of' and 'find_last_of' functions. Ie, when writing string.replace_first("foo", "bar"); I imagine we want to replace the first occurrence of 'foo' with 'bar', and not the first discovered character of 'f' and 'o'. A simple repro for the bogus behavior: #include using namespace Rcpp; // [[Rcpp::export]] String replace() { String foo("abba"); return foo.replace_first("ba", "BA"); } /*** R replace() */ gives > replace() [1] "BAba" which is I doubt what anyone would expect. On Sun, May 8, 2016 at 6:14 AM, ???? wrote: > I find a bug in String::replace_last(). > > I can reproduce the bug with the following code. > (I also showed output of replace_first and replace_all for comparison.) > > > ============= > // [[Rcpp::export]] > void rcpp_string(){ > > String s("abcdabcd"); > Rcout << "replace_first()\n"; > Rcout << s.replace_first("ab", "AB").get_cstring() << "\n"; > Rcout << "\n"; > > s="abcdabcd"; > Rcout << "replace_last()\n"; > Rcout << s.replace_last("ab", "AB").get_cstring() << "\n"; > Rcout << "\n"; > > s="abcdabcd"; > Rcout << "replace_all()\n"; > Rcout << s.replace_all("ab", "AB").get_cstring() << "\n"; > Rcout << "\n"; > } > ============= > > output > ============= > replace_first() > ABcdabcd > > replace_last() > abcdaABd > > replace_all() > ABcdABcd > ============= > > > I also tried to fix the bug with following code. And the bug seems to be fixed. > > ============= > inline String& replace_last(const char* s, const char* news) { > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); > if (is_na()) return *this; > setBuffer(); > //size_t index = buffer.find_last_of(s); > size_t index = buffer.find_last_of(s) - (strlen(s)-1); > Rcout << "A" << index << "\n"; > if (index != std::string::npos) buffer.replace(index, strlen(s), news); > valid = false; > return *this; > } > ============= > > output > ============= > replace_first() > ABcdabcd > > replace_last() > abcdABcd > > replace_all() > ABcdABcd > ============= > > > Mac OS 10.10.5 > R version 3.2.3 > Rcpp 0.12.4 > > > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel From jorismeys at gmail.com Mon May 16 21:07:55 2016 From: jorismeys at gmail.com (Joris Meys) Date: Mon, 16 May 2016 21:07:55 +0200 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() In-Reply-To: <2830E201-5537-42E5-B566-FC90062E085D@gmail.com> References: <2830E201-5537-42E5-B566-FC90062E085D@gmail.com> Message-ID: Dear Masaki, There is no need to send the same message 16 times to this list. It won't get it answered faster. If anything, it'll likely lessen the chance of receiving an answer. Please use this list with a bit consideration of those who aren't necessarily able to answer your question but still follow the discussion in order to learn a thing or two. Thank you Joris On Sun, May 15, 2016 at 5:19 PM, Masaki Tsuda wrote: > Hello, all > > This is my first post to this mailing list. > > I might have found bugs with String::replace_first() and > String::replace_last(). > The bugs can be reproduced by following code. > (R version 3.2.3 Rcpp 0.12.4) > > ------------------- > // [[Rcpp::export]] > void rcpp_string(){ > > String s("AABCDABCDA"); > Rcout << "replace_all()\n"; > Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; > Rcout << "\n"; > > s="AABCDABCDA"; > Rcout << "replace_first()\n"; > Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; > Rcout << "\n"; > > s="AABCDABCDA"; > Rcout << "replace_last()\n"; > Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; > Rcout << "\n"; > > } > ------------------- > > rcpp_string() > replace_all() > AabCDabCDA > > replace_first() > abBCDABCDA > > replace_last() > AABCDABCDab > ------------------- > > The problem is caused by find_first_of() and find_last_of() and it can be > resolved by replacing these functions to find() and rfind(). > > ------------------- > inline String& replace_first(const char* s, const char* news) { > RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const > char* = '%s')", s, news); > if (is_na()) return *this; > setBuffer(); > size_t index = buffer.find(s); > //size_t index = buffer.find_first_of(s); > if (index != std::string::npos) buffer.replace(index, strlen(s), news); > valid = false; > return *this; > } > > inline String& replace_last(const char* s, const char* news) { > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const > char* = '%s')", s, news); > if (is_na()) return *this; > setBuffer(); > size_t index = buffer.rfind(s); > //size_t index = buffer.find_last_of(s); > if (index != std::string::npos) buffer.replace(index, strlen(s), news); > valid = false; > return *this; > } > ------------------- > > rcpp_string() > replace_all() > AabCDabCDA > > replace_first() > AabCDABCDA > > replace_last() > AABCDabCDA > ------------------- > > Regards > > ------------------------------------------------------------------- > > Masaki Tsuda > E-mail : teuder at gmail.com > > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Mathematical Modelling, Statistics and Bio-Informatics tel : +32 (0)9 264 61 79 Joris.Meys at Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Mon May 16 21:16:39 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Mon, 16 May 2016 14:16:39 -0500 Subject: [Rcpp-devel] List outage Message-ID: <22330.7319.512643.811066@max.nulle.part> All, My apologies -- I didn't put 2+2 together to realize R-Forge mailing lists were down which I should have realized via at least three different lists that are somewhat active. Of these, rcpp-devel is clearly the largest and most active. I am sorry for any frustrations that caused anyone trying to post, and very grateful for the WU Vienna staff to fix this today, on a public holiday no less. I only wish I had reached earlier than yesterday. If anybody knows if there is a public 'status' page about mail delivery or queue size, please don't hesitate to let me know (either here or off-list). Dirk PS And my announcement yesterday should of course have had the correctly title Subject: [ANN] Rcpp 0.12.5 as we announced 0.12.5 and not 0.12.4. -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Mon May 16 22:53:02 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Mon, 16 May 2016 15:53:02 -0500 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() In-Reply-To: References: <2830E201-5537-42E5-B566-FC90062E085D@gmail.com> Message-ID: <22330.13102.60336.721148@max.nulle.part> On 16 May 2016 at 21:07, Joris Meys wrote: | There is no need to send the same message 16 times to this list. It won't get The list was down for several days, possibly a week. Hence the bulk delivery showing the different dates at which the mail was sent. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From qkou at umail.iu.edu Mon May 16 22:57:10 2016 From: qkou at umail.iu.edu (Qiang Kou) Date: Mon, 16 May 2016 16:57:10 -0400 Subject: [Rcpp-devel] Bug: replace_last() In-Reply-To: References: Message-ID: Yes, Kevin, I think we need something like size_t index = std::distance(buffer.begin(), std::search(buffer.begin(), buffer.end(), s.begin(), s.end())); KK On Mon, May 16, 2016 at 2:04 PM, Kevin Ushey wrote: > Thanks -- it looks to me like there is something more fundamentally > wrong with the 'replace_first' and 'replace_last' methods; ie, I don't > think we want to be using 'find_first_of' and 'find_last_of' > functions. > > Ie, when writing > > string.replace_first("foo", "bar"); > > I imagine we want to replace the first occurrence of 'foo' with 'bar', > and not the first discovered character of 'f' and 'o'. > > A simple repro for the bogus behavior: > > #include > using namespace Rcpp; > > // [[Rcpp::export]] > String replace() { > String foo("abba"); > return foo.replace_first("ba", "BA"); > } > > /*** R > replace() > */ > > gives > > > replace() > [1] "BAba" > > which is I doubt what anyone would expect. > > On Sun, May 8, 2016 at 6:14 AM, ???? wrote: > > I find a bug in String::replace_last(). > > > > I can reproduce the bug with the following code. > > (I also showed output of replace_first and replace_all for comparison.) > > > > > > ============= > > // [[Rcpp::export]] > > void rcpp_string(){ > > > > String s("abcdabcd"); > > Rcout << "replace_first()\n"; > > Rcout << s.replace_first("ab", "AB").get_cstring() << "\n"; > > Rcout << "\n"; > > > > s="abcdabcd"; > > Rcout << "replace_last()\n"; > > Rcout << s.replace_last("ab", "AB").get_cstring() << "\n"; > > Rcout << "\n"; > > > > s="abcdabcd"; > > Rcout << "replace_all()\n"; > > Rcout << s.replace_all("ab", "AB").get_cstring() << "\n"; > > Rcout << "\n"; > > } > > ============= > > > > output > > ============= > > replace_first() > > ABcdabcd > > > > replace_last() > > abcdaABd > > > > replace_all() > > ABcdABcd > > ============= > > > > > > I also tried to fix the bug with following code. And the bug seems to be > fixed. > > > > ============= > > inline String& replace_last(const char* s, const char* news) { > > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const > char* = '%s')", s, news); > > if (is_na()) return *this; > > setBuffer(); > > //size_t index = buffer.find_last_of(s); > > size_t index = buffer.find_last_of(s) - (strlen(s)-1); > > Rcout << "A" << index << "\n"; > > if (index != std::string::npos) buffer.replace(index, strlen(s), > news); > > valid = false; > > return *this; > > } > > ============= > > > > output > > ============= > > replace_first() > > ABcdabcd > > > > replace_last() > > abcdABcd > > > > replace_all() > > ABcdABcd > > ============= > > > > > > Mac OS 10.10.5 > > R version 3.2.3 > > Rcpp 0.12.4 > > > > > > _______________________________________________ > > Rcpp-devel mailing list > > Rcpp-devel at 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 at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > -- Qiang Kou qkou at umail.iu.edu School of Informatics and Computing, Indiana University -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Tue May 17 03:37:46 2016 From: teuder at gmail.com (teuder at gmail.com) Date: Tue, 17 May 2016 10:37:46 +0900 Subject: [Rcpp-devel] Bug report: String::replace_first() and String::replace_last() In-Reply-To: <22330.13102.60336.721148@max.nulle.part> References: <2830E201-5537-42E5-B566-FC90062E085D@gmail.com> <22330.13102.60336.721148@max.nulle.part> Message-ID: I'm sorry for embarrassing you all, I would explain the whole story below. As Dirk mentioned the mailing list had a problem at least from May 8 to today. So, my post was not delivered to members including me. I thought my post was rejected at first, but after several times trial I had doubt the list server had a problem. I reported this to Dirk, but he thought the mailing list was fine at the time. He reset my setting and I tried to post. We tackled on this problem for several days and during the process I tried to post many times. After all, the problem was the mailing list server did not deliver the posts but it accumulated in the delivery queue. Today, the server problem was fixed at last, and the list members encountered the flood of my "first post" ;) . Sincerely Masaki 2016/05/17 5:53?Dirk Eddelbuettel ??????: > > On 16 May 2016 at 21:07, Joris Meys wrote: > | There is no need to send the same message 16 times to this list. It won't get > > The list was down for several days, possibly a week. > > Hence the bulk delivery showing the different dates at which the mail was sent. > > Dirk > > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Tue May 17 03:42:39 2016 From: teuder at gmail.com (teuder at gmail.com) Date: Tue, 17 May 2016 10:42:39 +0900 Subject: [Rcpp-devel] Bug: replace_last() In-Reply-To: References: Message-ID: <96B52090-5B3D-4732-9D2B-889F624E73E1@gmail.com> Hi, Kevin and Qiang. After I sent my first post, I realized the problem as you pointed out. The problem can be resolved by replacing replace_first() and replace_last() to find() and rfind(). ------------------- inline String& replace_first(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.find(s); //size_t index = buffer.find_first_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } inline String& replace_last(const char* s, const char* news) { RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); if (is_na()) return *this; setBuffer(); size_t index = buffer.rfind(s); //size_t index = buffer.find_last_of(s); if (index != std::string::npos) buffer.replace(index, strlen(s), news); valid = false; return *this; } ------------------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------- Regards Masaki Masaki Tsuda teuder at gmail.com 2016/05/17 5:57?Qiang Kou ??????: > Yes, Kevin, > > I think we need something like > > size_t index = std::distance(buffer.begin(), std::search(buffer.begin(), buffer.end(), s.begin(), s.end())); > > KK > >> On Mon, May 16, 2016 at 2:04 PM, Kevin Ushey wrote: >> Thanks -- it looks to me like there is something more fundamentally >> wrong with the 'replace_first' and 'replace_last' methods; ie, I don't >> think we want to be using 'find_first_of' and 'find_last_of' >> functions. >> >> Ie, when writing >> >> string.replace_first("foo", "bar"); >> >> I imagine we want to replace the first occurrence of 'foo' with 'bar', >> and not the first discovered character of 'f' and 'o'. >> >> A simple repro for the bogus behavior: >> >> #include >> using namespace Rcpp; >> >> // [[Rcpp::export]] >> String replace() { >> String foo("abba"); >> return foo.replace_first("ba", "BA"); >> } >> >> /*** R >> replace() >> */ >> >> gives >> >> > replace() >> [1] "BAba" >> >> which is I doubt what anyone would expect. >> >> On Sun, May 8, 2016 at 6:14 AM, ???? wrote: >> > I find a bug in String::replace_last(). >> > >> > I can reproduce the bug with the following code. >> > (I also showed output of replace_first and replace_all for comparison.) >> > >> > >> > ============= >> > // [[Rcpp::export]] >> > void rcpp_string(){ >> > >> > String s("abcdabcd"); >> > Rcout << "replace_first()\n"; >> > Rcout << s.replace_first("ab", "AB").get_cstring() << "\n"; >> > Rcout << "\n"; >> > >> > s="abcdabcd"; >> > Rcout << "replace_last()\n"; >> > Rcout << s.replace_last("ab", "AB").get_cstring() << "\n"; >> > Rcout << "\n"; >> > >> > s="abcdabcd"; >> > Rcout << "replace_all()\n"; >> > Rcout << s.replace_all("ab", "AB").get_cstring() << "\n"; >> > Rcout << "\n"; >> > } >> > ============= >> > >> > output >> > ============= >> > replace_first() >> > ABcdabcd >> > >> > replace_last() >> > abcdaABd >> > >> > replace_all() >> > ABcdABcd >> > ============= >> > >> > >> > I also tried to fix the bug with following code. And the bug seems to be fixed. >> > >> > ============= >> > inline String& replace_last(const char* s, const char* news) { >> > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const char* = '%s')", s, news); >> > if (is_na()) return *this; >> > setBuffer(); >> > //size_t index = buffer.find_last_of(s); >> > size_t index = buffer.find_last_of(s) - (strlen(s)-1); >> > Rcout << "A" << index << "\n"; >> > if (index != std::string::npos) buffer.replace(index, strlen(s), news); >> > valid = false; >> > return *this; >> > } >> > ============= >> > >> > output >> > ============= >> > replace_first() >> > ABcdabcd >> > >> > replace_last() >> > abcdABcd >> > >> > replace_all() >> > ABcdABcd >> > ============= >> > >> > >> > Mac OS 10.10.5 >> > R version 3.2.3 >> > Rcpp 0.12.4 >> > >> > >> > _______________________________________________ >> > Rcpp-devel mailing list >> > Rcpp-devel at 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 at lists.r-forge.r-project.org >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > > > > -- > Qiang Kou > qkou at umail.iu.edu > School of Informatics and Computing, Indiana University > -------------- next part -------------- An HTML attachment was scrubbed... URL: From qkou at umail.iu.edu Tue May 17 05:03:42 2016 From: qkou at umail.iu.edu (Qiang Kou) Date: Mon, 16 May 2016 23:03:42 -0400 Subject: [Rcpp-devel] Bug: replace_last() In-Reply-To: <96B52090-5B3D-4732-9D2B-889F624E73E1@gmail.com> References: <96B52090-5B3D-4732-9D2B-889F624E73E1@gmail.com> Message-ID: Hi, Masaki, Please try the latest version on github. It should fix this bug. KK On Mon, May 16, 2016 at 9:42 PM, wrote: > Hi, Kevin and Qiang. > > After I sent my first post, I realized the problem as you pointed out. > > The problem can be resolved by replacing replace_first() and > replace_last() to find() and rfind(). > > ------------------- > inline String& replace_first(const char* s, const char* news) { > RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const > char* = '%s')", s, news); > if (is_na()) return *this; > setBuffer(); > size_t index = buffer.find(s); > //size_t index = buffer.find_first_of(s); > if (index != std::string::npos) buffer.replace(index, strlen(s), news); > valid = false; > return *this; > } > > inline String& replace_last(const char* s, const char* news) { > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const > char* = '%s')", s, news); > if (is_na()) return *this; > setBuffer(); > size_t index = buffer.rfind(s); > //size_t index = buffer.find_last_of(s); > if (index != std::string::npos) buffer.replace(index, strlen(s), news); > valid = false; > return *this; > } > ------------------- > > rcpp_string() > replace_all() > AabCDabCDA > > replace_first() > AabCDABCDA > > replace_last() > AABCDabCDA > ------------------- > > Regards > > Masaki > > > > Masaki Tsuda > teuder at gmail.com > > 2016/05/17 5:57?Qiang Kou ??????: > > Yes, Kevin, > > I think we need something like > > size_t index = std::distance(buffer.begin(), std::search(buffer.begin(), > buffer.end(), s.begin(), s.end())); > > KK > > On Mon, May 16, 2016 at 2:04 PM, Kevin Ushey wrote: > >> Thanks -- it looks to me like there is something more fundamentally >> wrong with the 'replace_first' and 'replace_last' methods; ie, I don't >> think we want to be using 'find_first_of' and 'find_last_of' >> functions. >> >> Ie, when writing >> >> string.replace_first("foo", "bar"); >> >> I imagine we want to replace the first occurrence of 'foo' with 'bar', >> and not the first discovered character of 'f' and 'o'. >> >> A simple repro for the bogus behavior: >> >> #include >> using namespace Rcpp; >> >> // [[Rcpp::export]] >> String replace() { >> String foo("abba"); >> return foo.replace_first("ba", "BA"); >> } >> >> /*** R >> replace() >> */ >> >> gives >> >> > replace() >> [1] "BAba" >> >> which is I doubt what anyone would expect. >> >> On Sun, May 8, 2016 at 6:14 AM, ???? wrote: >> > I find a bug in String::replace_last(). >> > >> > I can reproduce the bug with the following code. >> > (I also showed output of replace_first and replace_all for comparison.) >> > >> > >> > ============= >> > // [[Rcpp::export]] >> > void rcpp_string(){ >> > >> > String s("abcdabcd"); >> > Rcout << "replace_first()\n"; >> > Rcout << s.replace_first("ab", "AB").get_cstring() << "\n"; >> > Rcout << "\n"; >> > >> > s="abcdabcd"; >> > Rcout << "replace_last()\n"; >> > Rcout << s.replace_last("ab", "AB").get_cstring() << "\n"; >> > Rcout << "\n"; >> > >> > s="abcdabcd"; >> > Rcout << "replace_all()\n"; >> > Rcout << s.replace_all("ab", "AB").get_cstring() << "\n"; >> > Rcout << "\n"; >> > } >> > ============= >> > >> > output >> > ============= >> > replace_first() >> > ABcdabcd >> > >> > replace_last() >> > abcdaABd >> > >> > replace_all() >> > ABcdABcd >> > ============= >> > >> > >> > I also tried to fix the bug with following code. And the bug seems to >> be fixed. >> > >> > ============= >> > inline String& replace_last(const char* s, const char* news) { >> > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , >> const char* = '%s')", s, news); >> > if (is_na()) return *this; >> > setBuffer(); >> > //size_t index = buffer.find_last_of(s); >> > size_t index = buffer.find_last_of(s) - (strlen(s)-1); >> > Rcout << "A" << index << "\n"; >> > if (index != std::string::npos) buffer.replace(index, strlen(s), >> news); >> > valid = false; >> > return *this; >> > } >> > ============= >> > >> > output >> > ============= >> > replace_first() >> > ABcdabcd >> > >> > replace_last() >> > abcdABcd >> > >> > replace_all() >> > ABcdABcd >> > ============= >> > >> > >> > Mac OS 10.10.5 >> > R version 3.2.3 >> > Rcpp 0.12.4 >> > >> > >> > _______________________________________________ >> > Rcpp-devel mailing list >> > Rcpp-devel at 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 at lists.r-forge.r-project.org >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel >> > > > > -- > Qiang Kou > qkou at umail.iu.edu > School of Informatics and Computing, Indiana University > > -- Qiang Kou qkou at umail.iu.edu School of Informatics and Computing, Indiana University -------------- next part -------------- An HTML attachment was scrubbed... URL: From teuder at gmail.com Tue May 17 06:39:35 2016 From: teuder at gmail.com (Masaki Tsuda) Date: Tue, 17 May 2016 13:39:35 +0900 Subject: [Rcpp-devel] Bug: replace_last() In-Reply-To: References: <96B52090-5B3D-4732-9D2B-889F624E73E1@gmail.com> Message-ID: Hi, Quang I confirmed that the bug was fixed. Thank you for coping with the problem. -------- // [[Rcpp::export]] void rcpp_string(){ String s("AABCDABCDA"); Rcout << "replace_all()\n"; Rcout << s.replace_all("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_first()\n"; Rcout << s.replace_first("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; s="AABCDABCDA"; Rcout << "replace_last()\n"; Rcout << s.replace_last("AB", "ab").get_cstring() << "\n"; Rcout << "\n"; } --------- > rcpp_string() replace_all() AabCDabCDA replace_first() AabCDABCDA replace_last() AABCDabCDA ------------------------------------------------------------------- Masaki Tsuda E-mail : teuder at gmail.com 2016-05-17 12:03 GMT+09:00 Qiang Kou : > Hi, Masaki, > > Please try the latest version on github. It should fix this bug. > > KK > > On Mon, May 16, 2016 at 9:42 PM, wrote: > >> Hi, Kevin and Qiang. >> >> After I sent my first post, I realized the problem as you pointed out. >> >> The problem can be resolved by replacing replace_first() and >> replace_last() to find() and rfind(). >> >> ------------------- >> inline String& replace_first(const char* s, const char* news) { >> RCPP_STRING_DEBUG_2("String::replace_first(const char* = '%s' , const >> char* = '%s')", s, news); >> if (is_na()) return *this; >> setBuffer(); >> size_t index = buffer.find(s); >> //size_t index = buffer.find_first_of(s); >> if (index != std::string::npos) buffer.replace(index, strlen(s), news); >> valid = false; >> return *this; >> } >> >> inline String& replace_last(const char* s, const char* news) { >> RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , const >> char* = '%s')", s, news); >> if (is_na()) return *this; >> setBuffer(); >> size_t index = buffer.rfind(s); >> //size_t index = buffer.find_last_of(s); >> if (index != std::string::npos) buffer.replace(index, strlen(s), news); >> valid = false; >> return *this; >> } >> ------------------- >> > rcpp_string() >> replace_all() >> AabCDabCDA >> >> replace_first() >> AabCDABCDA >> >> replace_last() >> AABCDabCDA >> ------------------- >> >> Regards >> >> Masaki >> >> >> >> Masaki Tsuda >> teuder at gmail.com >> >> 2016/05/17 5:57?Qiang Kou ??????: >> >> Yes, Kevin, >> >> I think we need something like >> >> size_t index = std::distance(buffer.begin(), std::search(buffer.begin(), >> buffer.end(), s.begin(), s.end())); >> >> KK >> >> On Mon, May 16, 2016 at 2:04 PM, Kevin Ushey >> wrote: >> >>> Thanks -- it looks to me like there is something more fundamentally >>> wrong with the 'replace_first' and 'replace_last' methods; ie, I don't >>> think we want to be using 'find_first_of' and 'find_last_of' >>> functions. >>> >>> Ie, when writing >>> >>> string.replace_first("foo", "bar"); >>> >>> I imagine we want to replace the first occurrence of 'foo' with 'bar', >>> and not the first discovered character of 'f' and 'o'. >>> >>> A simple repro for the bogus behavior: >>> >>> #include >>> using namespace Rcpp; >>> >>> // [[Rcpp::export]] >>> String replace() { >>> String foo("abba"); >>> return foo.replace_first("ba", "BA"); >>> } >>> >>> /*** R >>> replace() >>> */ >>> >>> gives >>> >>> > replace() >>> [1] "BAba" >>> >>> which is I doubt what anyone would expect. >>> >>> On Sun, May 8, 2016 at 6:14 AM, ???? wrote: >>> > I find a bug in String::replace_last(). >>> > >>> > I can reproduce the bug with the following code. >>> > (I also showed output of replace_first and replace_all for comparison.) >>> > >>> > >>> > ============= >>> > // [[Rcpp::export]] >>> > void rcpp_string(){ >>> > >>> > String s("abcdabcd"); >>> > Rcout << "replace_first()\n"; >>> > Rcout << s.replace_first("ab", "AB").get_cstring() << "\n"; >>> > Rcout << "\n"; >>> > >>> > s="abcdabcd"; >>> > Rcout << "replace_last()\n"; >>> > Rcout << s.replace_last("ab", "AB").get_cstring() << "\n"; >>> > Rcout << "\n"; >>> > >>> > s="abcdabcd"; >>> > Rcout << "replace_all()\n"; >>> > Rcout << s.replace_all("ab", "AB").get_cstring() << "\n"; >>> > Rcout << "\n"; >>> > } >>> > ============= >>> > >>> > output >>> > ============= >>> > replace_first() >>> > ABcdabcd >>> > >>> > replace_last() >>> > abcdaABd >>> > >>> > replace_all() >>> > ABcdABcd >>> > ============= >>> > >>> > >>> > I also tried to fix the bug with following code. And the bug seems to >>> be fixed. >>> > >>> > ============= >>> > inline String& replace_last(const char* s, const char* news) { >>> > RCPP_STRING_DEBUG_2("String::replace_last(const char* = '%s' , >>> const char* = '%s')", s, news); >>> > if (is_na()) return *this; >>> > setBuffer(); >>> > //size_t index = buffer.find_last_of(s); >>> > size_t index = buffer.find_last_of(s) - (strlen(s)-1); >>> > Rcout << "A" << index << "\n"; >>> > if (index != std::string::npos) buffer.replace(index, strlen(s), >>> news); >>> > valid = false; >>> > return *this; >>> > } >>> > ============= >>> > >>> > output >>> > ============= >>> > replace_first() >>> > ABcdabcd >>> > >>> > replace_last() >>> > abcdABcd >>> > >>> > replace_all() >>> > ABcdABcd >>> > ============= >>> > >>> > >>> > Mac OS 10.10.5 >>> > R version 3.2.3 >>> > Rcpp 0.12.4 >>> > >>> > >>> > _______________________________________________ >>> > Rcpp-devel mailing list >>> > Rcpp-devel at 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 at lists.r-forge.r-project.org >>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel >>> >> >> >> >> -- >> Qiang Kou >> qkou at umail.iu.edu >> School of Informatics and Computing, Indiana University >> >> > > > -- > Qiang Kou > qkou at umail.iu.edu > School of Informatics and Computing, Indiana University > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rcpp at paulsaary.de Thu May 19 12:46:09 2016 From: rcpp at paulsaary.de (Paul Saary) Date: Thu, 19 May 2016 10:46:09 +0000 Subject: [Rcpp-devel] Transform arbitrary R object into std::vector> Message-ID: Hello, I have been trying to solve this problem for quite some time now, so I thought I'd ask here. I am trying to write a Cpp function, accepting multiple input types, such as matrices and dataframes. I understood that I could do this by accepting any SEXP object. The core problem now is to transform these object into something my software can use, which would be an object of type std::vector>. Currently my function looks like this: List handleRObject(SEXP Robj){ std::vector> internalMatrix; // convert Robj to internalMatrix // thats where I am stuck // do some stuff and return List return(wrap(someoutput)) } I tried many differnt things (using as, switch statements, etc...), but I do not seem to fully grasp on how tonhandle this problem, as none of them worked. I can transform a NumericMatrix using this code, but could not addapt this to a more general approach. // use rMatrix as input int nc = rMatrix.ncol(); internalMatrix.resize(nc); for( int i=0; i> In-Reply-To: References: Message-ID: Hi, Have you considered using the function as.matrix? It is an R function but you can call it from within your Rcpp code as well. Once you have a matrix you can use your matrix solution. Rgds Sameer On Thu, May 19, 2016 at 5:46 AM Paul Saary wrote: > Hello, > > I have been trying to solve this problem for quite some time now, so I > thought I'd ask here. > > I am trying to write a Cpp function, accepting multiple input types, > such as matrices and dataframes. > > I understood that I could do this by accepting any SEXP object. > > The core problem now is to transform these object into something my > software can use, which would be an object of type > std::vector>. > > Currently my function looks like this: > > List handleRObject(SEXP Robj){ > std::vector> internalMatrix; > > // convert Robj to internalMatrix > // thats where I am stuck > > // do some stuff and return List > return(wrap(someoutput)) > } > > I tried many differnt things (using as, switch statements, etc...), but > I do not seem to fully grasp on how tonhandle this problem, as none of > them worked. > > I can transform a NumericMatrix using this code, but could not addapt > this to a more general approach. > > // use rMatrix as input > int nc = rMatrix.ncol(); > internalMatrix.resize(nc); > for( int i=0; i NumericMatrix::Column col = rMatrix(_,i) ; > internalMatrix[i].assign( col.begin() , col.end() ) ; > } > > I though, maybe someone can give me a hint on how to solve this? > > Bests, > > Paul > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Thu May 19 14:07:26 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Thu, 19 May 2016 07:07:26 -0500 Subject: [Rcpp-devel] Transform arbitrary R object into std::vector> In-Reply-To: References: Message-ID: <22333.44158.297269.647466@max.nulle.part> On 19 May 2016 at 10:46, Paul Saary wrote: | Hello, | | I have been trying to solve this problem for quite some time now, so I | thought I'd ask here. | | I am trying to write a Cpp function, accepting multiple input types, | such as matrices and dataframes. | | I understood that I could do this by accepting any SEXP object. | | The core problem now is to transform these object into something my | software can use, which would be an object of type | std::vector>. If you always use vector< vector< double > > then I would start with Rcpp::NumericMatrix, or arma::mat. Do you know if you prefer rows or columns? It is pretty easy to pick off either rows and columns, but you may save yourself a transpose. Lastly, maybe consider switching your code to arma::mat instead of vector< vector< double > > which is really a fudge to make up for the lack of proper Matrix classes in C++ itself. On 19 May 2016 at 11:12, Sameer D'Costa wrote: | Have you considered using the function as.matrix? It is an R function but you | can call it from within your Rcpp code as well. Once you have a matrix you can | use your matrix solution.? I'd consider Rcpp::Function as a last resort. You do not need it here. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From sameerdcosta at gmail.com Thu May 19 14:40:07 2016 From: sameerdcosta at gmail.com (Sameer D'Costa) Date: Thu, 19 May 2016 12:40:07 +0000 Subject: [Rcpp-devel] Transform arbitrary R object into std::vector> In-Reply-To: <22333.44158.297269.647466@max.nulle.part> References: <22333.44158.297269.647466@max.nulle.part> Message-ID: On Thu, May 19, 2016 at 7:07 AM Dirk Eddelbuettel wrote: > > I'd consider Rcpp::Function as a last resort. You do not need it here. > Yes I don't like using Rcpp:Function either however it isn't easy to convert a data.frame into matrix in Rcpp. You have to write code to deal with factors and non-numeric columns that might be passed in. Also the original question was asked for SEXP objects. And I'm not sure how you would deal with those without Rcpp::Function. If there is an easy way I would be interested in learning about it. Rgds -------------- next part -------------- An HTML attachment was scrubbed... URL: From rcpp at paulsaary.de Thu May 19 14:47:23 2016 From: rcpp at paulsaary.de (Paul Saary) Date: Thu, 19 May 2016 12:47:23 +0000 Subject: [Rcpp-devel] Transform arbitrary R object into std::vector> In-Reply-To: <22333.44158.297269.647466@max.nulle.part> References: <22333.44158.297269.647466@max.nulle.part> Message-ID: <0a6e5dff-eb1a-05e8-6aeb-54bf55943914@paulsaary.de> Thank you for your reply, > If you always use vector< vector< double > > then I would start with > Rcpp::NumericMatrix, or arma::mat. The problem is, that I want to offer the user a choice of using also data.frames and not just Matrices. So I can not really decide, with what I start, or am I wrong? Regarding the use of Rcpp:function: As the R objects used are very large (many MB to some GB), I would like to do the transformation into a usable format, in my case into the vector< vector< double > >, in CPP, as I imagine it to be much faster. I will have look into armadillo, but I hoped to avoid loading another library, to reduce the depencies of my script/package. Paul On 19.05.2016 12:07, Dirk Eddelbuettel wrote: > > On 19 May 2016 at 10:46, Paul Saary wrote: > | Hello, > | > | I have been trying to solve this problem for quite some time now, so I > | thought I'd ask here. > | > | I am trying to write a Cpp function, accepting multiple input types, > | such as matrices and dataframes. > | > | I understood that I could do this by accepting any SEXP object. > | > | The core problem now is to transform these object into something my > | software can use, which would be an object of type > | std::vector>. > > If you always use vector< vector< double > > then I would start with > Rcpp::NumericMatrix, or arma::mat. > > Do you know if you prefer rows or columns? It is pretty easy to pick off > either rows and columns, but you may save yourself a transpose. > > Lastly, maybe consider switching your code to arma::mat instead of vector< > vector< double > > which is really a fudge to make up for the lack of proper > Matrix classes in C++ itself. > > On 19 May 2016 at 11:12, Sameer D'Costa wrote: > | Have you considered using the function as.matrix? It is an R function but you > | can call it from within your Rcpp code as well. Once you have a matrix you can > | use your matrix solution. > > I'd consider Rcpp::Function as a last resort. You do not need it here. > > Dirk > From edd at debian.org Thu May 19 14:54:29 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Thu, 19 May 2016 07:54:29 -0500 Subject: [Rcpp-devel] Transform arbitrary R object into std::vector> In-Reply-To: <0a6e5dff-eb1a-05e8-6aeb-54bf55943914@paulsaary.de> References: <22333.44158.297269.647466@max.nulle.part> <0a6e5dff-eb1a-05e8-6aeb-54bf55943914@paulsaary.de> Message-ID: <22333.46981.998289.85334@max.nulle.part> On 19 May 2016 at 12:47, Paul Saary wrote: | Thank you for your reply, | | > If you always use vector< vector< double > > then I would start with | > Rcpp::NumericMatrix, or arma::mat. | | The problem is, that I want to offer the user a choice of using also | data.frames and not just Matrices. So I can not really decide, with what | I start, or am I wrong? Yes :) A data.frame is simply not a matrix. It allows different types. Which you cannot represent here. | Regarding the use of Rcpp:function: | As the R objects used are very large (many MB to some GB), I would like | to do the transformation into a usable format, in my case into the | vector< vector< double > >, in CPP, as I imagine it to be much faster. Imagination can be a dangerous thing. Most of us prefer profiling. | I will have look into armadillo, but I hoped to avoid loading another | library, to reduce the depencies of my script/package. Please do look into it. It is worth it. And the added size, relative to the footprint you already have with R, is marginal. And there is none at run-time -- C++ and all that. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From toduc at stat.unipd.it Thu May 19 15:31:28 2016 From: toduc at stat.unipd.it (To Duc Khanh) Date: Thu, 19 May 2016 15:31:28 +0200 Subject: [Rcpp-devel] Transform arbitrary R object into std::vector> In-Reply-To: <22333.46981.998289.85334@max.nulle.part> References: <22333.44158.297269.647466@max.nulle.part> <0a6e5dff-eb1a-05e8-6aeb-54bf55943914@paulsaary.de> <22333.46981.998289.85334@max.nulle.part> Message-ID: Hi, Paul Saary For a data.frame, you should use as.matrix(data.frame) before use its in C/C++ function. That is my experiment. > > On 19 May 2016 at 12:47, Paul Saary wrote: > | Thank you for your reply, > | > | > If you always use vector< vector< double > > then I would start with > | > Rcpp::NumericMatrix, or arma::mat. > | > | The problem is, that I want to offer the user a choice of using also > | data.frames and not just Matrices. So I can not really decide, with what > | I start, or am I wrong? > > Yes :) > > A data.frame is simply not a matrix. It allows different types. Which you > cannot represent here. > > | Regarding the use of Rcpp:function: > | As the R objects used are very large (many MB to some GB), I would like > | to do the transformation into a usable format, in my case into the > | vector< vector< double > >, in CPP, as I imagine it to be much faster. > > Imagination can be a dangerous thing. Most of us prefer profiling. > > | I will have look into armadillo, but I hoped to avoid loading another > | library, to reduce the depencies of my script/package. > > Please do look into it. It is worth it. And the added size, relative to > the > footprint you already have with R, is marginal. And there is none at > run-time -- C++ and all that. > > Dirk > > -- > http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > > -- Khanh To Duc PhD student, Department of Statistical Science, XXIX cycle. Office: Room 130 Telephone: +39 049 827 4147 Mobile: +39 345 667 0711 http://www.stat.unipd.it/it/fare-ricerca/duc-khanh From francois.rousset at umontpellier.fr Sun May 22 12:09:01 2016 From: francois.rousset at umontpellier.fr (=?UTF-8?Q?Fran=c3=a7ois_Rousset?=) Date: Sun, 22 May 2016 12:09:01 +0200 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. Message-ID: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> Hi, RcppEigen no longer passes the CRAN checks for Windows i386 architecture: https://cran.r-project.org/web/checks/check_results_RcppEigen.html This problem seems to have appeared in the middle of last month, presumably following some change on CRAN. A similar problem appeared at the same time in some packages I maintain, which link to RcppEigen. For one package, execution stops on a line of the form MatrixXd someMatrix(MatrixXd(nb,nb).setZero().selfadjointView().rankUpdate( anotherMatrix )); I have reduced the code causing the error to a small reproducible example, and since I can reproduce the error only on the win-builder service on CRAN, not on my Windows PC, this example takes the form of a package 'minimalTest'. It can be downloaded from http://kimura.univ-montp2.fr/~rousset/minimalTest_1.1.3.tar.gz. I hope the following may help in correcting RcppEigen (as I think I can circumvent the problem in my package), but I am also curious whether I am missing some obvious error in my code. In this small example, the checks fail (on Windows i386 only; the relevant part of the check log is pasted at the end of this message) when executing mini(14) where the mini() function is // [[Rcpp::export]] int mini( int nb ){ MatrixXd swZ(nb,nb); swZ.setZero(); Rcout <<"Trivial code: swZ.selfadjointView().rankUpdate(swZ):"<().rankUpdate(swZ); Rcout << "after minimal test. "< X(as >(XX)); SparseQR, Eigen::COLAMDOrdering > spQR(X); SparseMatrix Q_ap(5,5); Q_ap.setZero(); List out = List::create(Named("Q_ap") = Q_ap); return(out); } // [[Rcpp::export]] SEXP unusedFn2( SEXP ZZ ) { const Map Z(as >(ZZ)); int c(Z.cols()); if (c==0) return(wrap(MatrixXd(0,0))); MatrixXd bidon(MatrixXd(c,c).setZero()); MatrixXd swZ(MatrixXd(c,c).setZero().selfadjointView().rankUpdate(bidon.transpose())); return(wrap(swZ)); } The problem does not occur if either of these two functions is removed from the sources. I found that I could resolve the problem in my original package by removing any Eigen::SparseMatrix-related code from it. Much as in the checks for the small example package, that code was not called in the checks for my original package. The small example package does not contain other C++ or R functions (except those generated automatically by Rcpp). Can anyone make sense of this? Thanks in advance, F.R. ============================================== ** running examples for arch 'i386' ... ERROR Running examples in 'minimalTest-Ex.R' failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: mini > ### Title: Test RcppEigen code > ### Aliases: mini unusedFn1 unusedFn2 > > ### ** Examples > > sessionInfo() R Under development (unstable) (2016-05-21 r70655) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows Server 2008 x64 (build 6002) Service Pack 2 locale: [1] LC_COLLATE=C LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=C LC_NUMERIC=C [5] LC_TIME=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] minimalTest_1.1.3 loaded via a namespace (and not attached): [1] Rcpp_0.12.5 > mini(14) Trivial code: swZ.selfadjointView().rankUpdate(swZ): ** running examples for arch 'x64' ... [1s] OK * checking PDF version of manual ... OK * DONE =============================================== From edd at debian.org Sun May 22 16:13:37 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Sun, 22 May 2016 09:13:37 -0500 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> Message-ID: <22337.48785.425157.848058@max.nulle.part> Hi Francois, Thanks for taking the time to track this down and to create an example. I just opened a GitHub issue for it: https://github.com/RcppCore/RcppEigen/issues/34 Feel free to comment there as well. On 22 May 2016 at 12:09, Fran?ois Rousset wrote: | Hi, | | RcppEigen no longer passes the CRAN checks for Windows i386 architecture: | https://cran.r-project.org/web/checks/check_results_RcppEigen.html | This problem seems to have appeared in the middle of last month, | presumably following some change on CRAN. | | A similar problem appeared at the same time in some packages I maintain, | which link to RcppEigen. For one package, execution stops on a line of | the form | MatrixXd | someMatrix(MatrixXd(nb,nb).setZero().selfadjointView().rankUpdate( | anotherMatrix )); | I have reduced the code causing the error to a small reproducible | example, and since I can reproduce the error only on the win-builder | service on CRAN, not on my Windows PC, this example takes the form of a | package 'minimalTest'. It can be downloaded from | http://kimura.univ-montp2.fr/~rousset/minimalTest_1.1.3.tar.gz. | | I hope the following may help in correcting RcppEigen (as I think I can | circumvent the problem in my package), but I am also curious whether I | am missing some obvious error in my code. | | In this small example, the checks fail (on Windows i386 only; the | relevant part of the check log is pasted at the end of this message) | when executing | | mini(14) | | where the mini() function is | | // [[Rcpp::export]] | int mini( int nb ){ | MatrixXd swZ(nb,nb); | swZ.setZero(); | Rcout <<"Trivial code: | swZ.selfadjointView().rankUpdate(swZ):"<().rankUpdate(swZ); | Rcout << "after minimal test. "< X(as >(XX)); | SparseQR, | Eigen::COLAMDOrdering > spQR(X); | SparseMatrix Q_ap(5,5); | Q_ap.setZero(); | List out = List::create(Named("Q_ap") = Q_ap); | return(out); | } | | // [[Rcpp::export]] | SEXP unusedFn2( SEXP ZZ ) { | const Map Z(as >(ZZ)); | int c(Z.cols()); | if (c==0) return(wrap(MatrixXd(0,0))); | MatrixXd bidon(MatrixXd(c,c).setZero()); | MatrixXd | swZ(MatrixXd(c,c).setZero().selfadjointView().rankUpdate(bidon.transpose())); | return(wrap(swZ)); | } | | The problem does not occur if either of these two functions is removed | from the sources. I found that I could resolve the problem in my | original package by removing any Eigen::SparseMatrix-related code from | it. Much as in the checks for the small example package, that code was | not called in the checks for my original package. | | The small example package does not contain other C++ or R functions | (except those generated automatically by Rcpp). | | Can anyone make sense of this? The fact that inclusion of other code, which is not called and should be optimized away, is involved is really, really weird. All I can think of so far is maybe some macro going haywire? Dirk | Thanks in advance, | | F.R. | | ============================================== | ** running examples for arch 'i386' ... ERROR | Running examples in 'minimalTest-Ex.R' failed | The error most likely occurred in: | | > base::assign(".ptime", proc.time(), pos = "CheckExEnv") | > ### Name: mini | > ### Title: Test RcppEigen code | > ### Aliases: mini unusedFn1 unusedFn2 | > | > ### ** Examples | > | > sessionInfo() | R Under development (unstable) (2016-05-21 r70655) | Platform: i386-w64-mingw32/i386 (32-bit) | Running under: Windows Server 2008 x64 (build 6002) Service Pack 2 | | locale: | [1] LC_COLLATE=C LC_CTYPE=German_Germany.1252 | [3] LC_MONETARY=C LC_NUMERIC=C | [5] LC_TIME=C | | attached base packages: | [1] stats graphics grDevices utils datasets methods base | | other attached packages: | [1] minimalTest_1.1.3 | | loaded via a namespace (and not attached): | [1] Rcpp_0.12.5 | > mini(14) | Trivial code: swZ.selfadjointView().rankUpdate(swZ): | ** running examples for arch 'x64' ... [1s] OK | * checking PDF version of manual ... OK | * DONE | =============================================== | _______________________________________________ | Rcpp-devel mailing list | Rcpp-devel at lists.r-forge.r-project.org | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From edd at debian.org Sun May 22 22:16:18 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Sun, 22 May 2016 15:16:18 -0500 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <22337.48785.425157.848058@max.nulle.part> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> Message-ID: <22338.5010.871572.413549@max.nulle.part> On 22 May 2016 at 09:13, Dirk Eddelbuettel wrote: | | Hi Francois, | | Thanks for taking the time to track this down and to create an example. | I just opened a GitHub issue for it: | https://github.com/RcppCore/RcppEigen/issues/34 | Feel free to comment there as well. In that thread on GH, Dan raises a good point: what actually is the supposed error message? What you have at the end of this long email isn't all that clear and _still indirect_: "Running examples in 'minimalTest-Ex.R' failed" For those of us without a windows 32bit machine at hand, can you (or anybody else) actually produce an error message? Preferably with compiler output? Dirk | On 22 May 2016 at 12:09, Fran?ois Rousset wrote: | | Hi, | | | | RcppEigen no longer passes the CRAN checks for Windows i386 architecture: | | https://cran.r-project.org/web/checks/check_results_RcppEigen.html | | This problem seems to have appeared in the middle of last month, | | presumably following some change on CRAN. | | | | A similar problem appeared at the same time in some packages I maintain, | | which link to RcppEigen. For one package, execution stops on a line of | | the form | | MatrixXd | | someMatrix(MatrixXd(nb,nb).setZero().selfadjointView().rankUpdate( | | anotherMatrix )); | | I have reduced the code causing the error to a small reproducible | | example, and since I can reproduce the error only on the win-builder | | service on CRAN, not on my Windows PC, this example takes the form of a | | package 'minimalTest'. It can be downloaded from | | http://kimura.univ-montp2.fr/~rousset/minimalTest_1.1.3.tar.gz. | | | | I hope the following may help in correcting RcppEigen (as I think I can | | circumvent the problem in my package), but I am also curious whether I | | am missing some obvious error in my code. | | | | In this small example, the checks fail (on Windows i386 only; the | | relevant part of the check log is pasted at the end of this message) | | when executing | | | | mini(14) | | | | where the mini() function is | | | | // [[Rcpp::export]] | | int mini( int nb ){ | | MatrixXd swZ(nb,nb); | | swZ.setZero(); | | Rcout <<"Trivial code: | | swZ.selfadjointView().rankUpdate(swZ):"<().rankUpdate(swZ); | | Rcout << "after minimal test. "< X(as >(XX)); | | SparseQR, | | Eigen::COLAMDOrdering > spQR(X); | | SparseMatrix Q_ap(5,5); | | Q_ap.setZero(); | | List out = List::create(Named("Q_ap") = Q_ap); | | return(out); | | } | | | | // [[Rcpp::export]] | | SEXP unusedFn2( SEXP ZZ ) { | | const Map Z(as >(ZZ)); | | int c(Z.cols()); | | if (c==0) return(wrap(MatrixXd(0,0))); | | MatrixXd bidon(MatrixXd(c,c).setZero()); | | MatrixXd | | swZ(MatrixXd(c,c).setZero().selfadjointView().rankUpdate(bidon.transpose())); | | return(wrap(swZ)); | | } | | | | The problem does not occur if either of these two functions is removed | | from the sources. I found that I could resolve the problem in my | | original package by removing any Eigen::SparseMatrix-related code from | | it. Much as in the checks for the small example package, that code was | | not called in the checks for my original package. | | | | The small example package does not contain other C++ or R functions | | (except those generated automatically by Rcpp). | | | | Can anyone make sense of this? | | The fact that inclusion of other code, which is not called and should be | optimized away, is involved is really, really weird. | | All I can think of so far is maybe some macro going haywire? | | Dirk | | | Thanks in advance, | | | | F.R. | | | | ============================================== | | ** running examples for arch 'i386' ... ERROR | | Running examples in 'minimalTest-Ex.R' failed | | The error most likely occurred in: | | | | > base::assign(".ptime", proc.time(), pos = "CheckExEnv") | | > ### Name: mini | | > ### Title: Test RcppEigen code | | > ### Aliases: mini unusedFn1 unusedFn2 | | > | | > ### ** Examples | | > | | > sessionInfo() | | R Under development (unstable) (2016-05-21 r70655) | | Platform: i386-w64-mingw32/i386 (32-bit) | | Running under: Windows Server 2008 x64 (build 6002) Service Pack 2 | | | | locale: | | [1] LC_COLLATE=C LC_CTYPE=German_Germany.1252 | | [3] LC_MONETARY=C LC_NUMERIC=C | | [5] LC_TIME=C | | | | attached base packages: | | [1] stats graphics grDevices utils datasets methods base | | | | other attached packages: | | [1] minimalTest_1.1.3 | | | | loaded via a namespace (and not attached): | | [1] Rcpp_0.12.5 | | > mini(14) | | Trivial code: swZ.selfadjointView().rankUpdate(swZ): | | ** running examples for arch 'x64' ... [1s] OK | | * checking PDF version of manual ... OK | | * DONE | | =============================================== | | _______________________________________________ | | Rcpp-devel mailing list | | Rcpp-devel at lists.r-forge.r-project.org | | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel | | -- | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org | _______________________________________________ | Rcpp-devel mailing list | Rcpp-devel at lists.r-forge.r-project.org | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From francois.rousset at umontpellier.fr Sun May 22 22:48:46 2016 From: francois.rousset at umontpellier.fr (=?UTF-8?Q?Fran=c3=a7ois_Rousset?=) Date: Sun, 22 May 2016 22:48:46 +0200 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <22338.5010.871572.413549@max.nulle.part> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> <22338.5010.871572.413549@max.nulle.part> Message-ID: <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> Hi, Le 22/05/2016 ? 22:16, Dirk Eddelbuettel a ?crit : > On 22 May 2016 at 09:13, Dirk Eddelbuettel wrote: > | > | Hi Francois, > | > | Thanks for taking the time to track this down and to create an example. > | I just opened a GitHub issue for it: > | https://github.com/RcppCore/RcppEigen/issues/34 > | Feel free to comment there as well. > > In that thread on GH, Dan raises a good point: what actually is the supposed > error message? What you have at the end of this long email isn't all that > clear and _still indirect_: "Running examples in 'minimalTest-Ex.R' failed" > > For those of us without a windows 32bit machine at hand, can you (or anybody > else) actually produce an error message? Preferably with compiler output? I never obtained a more useful error message. I have been running the CRAN checks routinely on my windows PC both for 32 and 64 bit builds without any problem. Compilation itself does not generate any particular message. Below are the screen logs on my PC: ========================================================= ==> Rcmd.exe INSTALL --preclean --with-keep.source minimalTest * installing to library 'C:/Users/francois/Documents/R/win-library/3.4' * installing *source* package 'minimalTest' ... ** libs *** arch - i386 "C:/Rtools/mingw_32/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o "C:/Rtools/mingw_32/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c spaMM_linear.cpp -o spaMM_linear.o C:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o minimalTest.dll tmp.def RcppExports.o spaMM_linear.o -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-devel/bin/i386 -lR installing to C:/Users/francois/Documents/R/win-library/3.4/minimalTest/libs/i386 *** arch - x64 "C:/Rtools/mingw_64/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -c RcppExports.cpp -o RcppExports.o "C:/Rtools/mingw_64/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -c spaMM_linear.cpp -o spaMM_linear.o C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o minimalTest.dll tmp.def RcppExports.o spaMM_linear.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-devel/bin/x64 -lR installing to C:/Users/francois/Documents/R/win-library/3.4/minimalTest/libs/x64 ** R ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded *** arch - i386 *** arch - x64 * DONE (minimalTest) ========================================================= ==> Rcmd.exe build minimalTest * checking for file 'minimalTest/DESCRIPTION' ... OK * preparing 'minimalTest': * checking DESCRIPTION meta-information ... OK * cleaning src * checking for LF line-endings in source and make files * checking for empty or unneeded directories * building 'minimalTest_1.1.3.tar.gz' ==> Rcmd.exe check minimalTest_1.1.3.tar.gz * using log directory 'C:/home/francois/travail/stats/CRANhell/minimalTest.Rcheck' * using R Under development (unstable) (2016-05-14 r70617) * using platform: x86_64-w64-mingw32 (64-bit) * using session charset: ISO8859-1 * checking for file 'minimalTest/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'minimalTest' version '1.1.3' * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking whether package 'minimalTest' can be installed ... [21s] OK * checking installed package size ... OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * loading checks for arch 'i386' ** checking whether the package can be loaded ... OK ** checking whether the package can be loaded with stated dependencies ... OK ** checking whether the package can be unloaded cleanly ... OK ** checking whether the namespace can be loaded with stated dependencies ... OK ** checking whether the namespace can be unloaded cleanly ... OK ** checking loading without being on the library search path ... OK * loading checks for arch 'x64' ** checking whether the package can be loaded ... OK ** checking whether the package can be loaded with stated dependencies ... OK ** checking whether the package can be unloaded cleanly ... OK ** checking whether the namespace can be loaded with stated dependencies ... OK ** checking whether the namespace can be unloaded cleanly ... OK ** checking loading without being on the library search path ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking compiled code ... OK * checking examples ... ** running examples for arch 'i386' ... [0s] OK ** running examples for arch 'x64' ... [0s] OK * checking PDF version of manual ... OK * DONE Status: OK R CMD check succeeded =============================================== > Dirk > > | On 22 May 2016 at 12:09, Fran?ois Rousset wrote: > | | Hi, > | | > | | RcppEigen no longer passes the CRAN checks for Windows i386 architecture: > | | https://cran.r-project.org/web/checks/check_results_RcppEigen.html > | | This problem seems to have appeared in the middle of last month, > | | presumably following some change on CRAN. > | | > | | A similar problem appeared at the same time in some packages I maintain, > | | which link to RcppEigen. For one package, execution stops on a line of > | | the form > | | MatrixXd > | | someMatrix(MatrixXd(nb,nb).setZero().selfadjointView().rankUpdate( > | | anotherMatrix )); > | | I have reduced the code causing the error to a small reproducible > | | example, and since I can reproduce the error only on the win-builder > | | service on CRAN, not on my Windows PC, this example takes the form of a > | | package 'minimalTest'. It can be downloaded from > | | http://kimura.univ-montp2.fr/~rousset/minimalTest_1.1.3.tar.gz. > | | > | | I hope the following may help in correcting RcppEigen (as I think I can > | | circumvent the problem in my package), but I am also curious whether I > | | am missing some obvious error in my code. > | | > | | In this small example, the checks fail (on Windows i386 only; the > | | relevant part of the check log is pasted at the end of this message) > | | when executing > | | > | | mini(14) > | | > | | where the mini() function is > | | > | | // [[Rcpp::export]] > | | int mini( int nb ){ > | | MatrixXd swZ(nb,nb); > | | swZ.setZero(); > | | Rcout <<"Trivial code: > | | swZ.selfadjointView().rankUpdate(swZ):"< | | swZ.selfadjointView().rankUpdate(swZ); > | | Rcout << "after minimal test. "< | | occurs > | | return(0); > | | } > | | > | | However, the problem occurs only when two other functions, derived from > | | more meaningful functions in the original package, are included in the > | | sources (yet are not called by the tests): > | | > | | // [[Rcpp::export]] > | | List unusedFn1( SEXP XX ) { > | | const MappedSparseMatrix X(as >(XX)); > | | SparseQR, > | | Eigen::COLAMDOrdering > spQR(X); > | | SparseMatrix Q_ap(5,5); > | | Q_ap.setZero(); > | | List out = List::create(Named("Q_ap") = Q_ap); > | | return(out); > | | } > | | > | | // [[Rcpp::export]] > | | SEXP unusedFn2( SEXP ZZ ) { > | | const Map Z(as >(ZZ)); > | | int c(Z.cols()); > | | if (c==0) return(wrap(MatrixXd(0,0))); > | | MatrixXd bidon(MatrixXd(c,c).setZero()); > | | MatrixXd > | | swZ(MatrixXd(c,c).setZero().selfadjointView().rankUpdate(bidon.transpose())); > | | return(wrap(swZ)); > | | } > | | > | | The problem does not occur if either of these two functions is removed > | | from the sources. I found that I could resolve the problem in my > | | original package by removing any Eigen::SparseMatrix-related code from > | | it. Much as in the checks for the small example package, that code was > | | not called in the checks for my original package. > | | > | | The small example package does not contain other C++ or R functions > | | (except those generated automatically by Rcpp). > | | > | | Can anyone make sense of this? > | > | The fact that inclusion of other code, which is not called and should be > | optimized away, is involved is really, really weird. > | > | All I can think of so far is maybe some macro going haywire? > | > | Dirk > | > | | Thanks in advance, > | | > | | F.R. > | | > | | ============================================== > | | ** running examples for arch 'i386' ... ERROR > | | Running examples in 'minimalTest-Ex.R' failed > | | The error most likely occurred in: > | | > | | > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > | | > ### Name: mini > | | > ### Title: Test RcppEigen code > | | > ### Aliases: mini unusedFn1 unusedFn2 > | | > > | | > ### ** Examples > | | > > | | > sessionInfo() > | | R Under development (unstable) (2016-05-21 r70655) > | | Platform: i386-w64-mingw32/i386 (32-bit) > | | Running under: Windows Server 2008 x64 (build 6002) Service Pack 2 > | | > | | locale: > | | [1] LC_COLLATE=C LC_CTYPE=German_Germany.1252 > | | [3] LC_MONETARY=C LC_NUMERIC=C > | | [5] LC_TIME=C > | | > | | attached base packages: > | | [1] stats graphics grDevices utils datasets methods base > | | > | | other attached packages: > | | [1] minimalTest_1.1.3 > | | > | | loaded via a namespace (and not attached): > | | [1] Rcpp_0.12.5 > | | > mini(14) > | | Trivial code: swZ.selfadjointView().rankUpdate(swZ): > | | ** running examples for arch 'x64' ... [1s] OK > | | * checking PDF version of manual ... OK > | | * DONE > | | =============================================== > | | _______________________________________________ > | | Rcpp-devel mailing list > | | Rcpp-devel at lists.r-forge.r-project.org > | | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > | > | -- > | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org > | _______________________________________________ > | Rcpp-devel mailing list > | Rcpp-devel at lists.r-forge.r-project.org > | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > From dcdillon at gmail.com Sun May 22 22:51:22 2016 From: dcdillon at gmail.com (Dan Dillon) Date: Sun, 22 May 2016 15:51:22 -0500 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> <22338.5010.871572.413549@max.nulle.part> <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> Message-ID: Do you have the same version of mingw as cran? If not , that would be a good test On May 22, 2016 3:49 PM, "Fran?ois Rousset" < francois.rousset at umontpellier.fr> wrote: > Hi, > > Le 22/05/2016 ? 22:16, Dirk Eddelbuettel a ?crit : > >> On 22 May 2016 at 09:13, Dirk Eddelbuettel wrote: >> | >> | Hi Francois, >> | >> | Thanks for taking the time to track this down and to create an example. >> | I just opened a GitHub issue for it: >> | https://github.com/RcppCore/RcppEigen/issues/34 >> | Feel free to comment there as well. >> >> In that thread on GH, Dan raises a good point: what actually is the >> supposed >> error message? What you have at the end of this long email isn't all that >> clear and _still indirect_: "Running examples in 'minimalTest-Ex.R' >> failed" >> >> For those of us without a windows 32bit machine at hand, can you (or >> anybody >> else) actually produce an error message? Preferably with compiler output? >> > I never obtained a more useful error message. I have been running the CRAN > checks routinely on my windows PC both for 32 and 64 bit builds without any > problem. Compilation itself does not generate any particular message. Below > are the screen logs on my PC: > > ========================================================= > ==> Rcmd.exe INSTALL --preclean --with-keep.source minimalTest > > * installing to library 'C:/Users/francois/Documents/R/win-library/3.4' > * installing *source* package 'minimalTest' ... > ** libs > > *** arch - i386 > "C:/Rtools/mingw_32/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c > RcppExports.cpp -o RcppExports.o > "C:/Rtools/mingw_32/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c > spaMM_linear.cpp -o spaMM_linear.o > C:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o minimalTest.dll > tmp.def RcppExports.o spaMM_linear.o > -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 > -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-devel/bin/i386 -lR > installing to > C:/Users/francois/Documents/R/win-library/3.4/minimalTest/libs/i386 > > *** arch - x64 > "C:/Rtools/mingw_64/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -c RcppExports.cpp -o > RcppExports.o > "C:/Rtools/mingw_64/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -c spaMM_linear.cpp -o > spaMM_linear.o > C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o minimalTest.dll > tmp.def RcppExports.o spaMM_linear.o > -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 > -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-devel/bin/x64 -lR > installing to > C:/Users/francois/Documents/R/win-library/3.4/minimalTest/libs/x64 > ** R > ** byte-compile and prepare package for lazy loading > ** help > *** installing help indices > ** building package indices > ** testing if installed package can be loaded > *** arch - i386 > *** arch - x64 > * DONE (minimalTest) > ========================================================= > ==> Rcmd.exe build minimalTest > > * checking for file 'minimalTest/DESCRIPTION' ... OK > * preparing 'minimalTest': > * checking DESCRIPTION meta-information ... OK > * cleaning src > * checking for LF line-endings in source and make files > * checking for empty or unneeded directories > * building 'minimalTest_1.1.3.tar.gz' > > ==> Rcmd.exe check minimalTest_1.1.3.tar.gz > > * using log directory > 'C:/home/francois/travail/stats/CRANhell/minimalTest.Rcheck' > * using R Under development (unstable) (2016-05-14 r70617) > * using platform: x86_64-w64-mingw32 (64-bit) > * using session charset: ISO8859-1 > * checking for file 'minimalTest/DESCRIPTION' ... OK > * checking extension type ... Package > * this is package 'minimalTest' version '1.1.3' > * package encoding: UTF-8 > * checking package namespace information ... OK > * checking package dependencies ... OK > * checking if this is a source package ... OK > * checking if there is a namespace ... OK > * checking for executable files ... OK > * checking for hidden files and directories ... OK > * checking for portable file names ... OK > * checking whether package 'minimalTest' can be installed ... [21s] OK > * checking installed package size ... OK > * checking package directory ... OK > * checking DESCRIPTION meta-information ... OK > * checking top-level files ... OK > * checking for left-over files ... OK > * checking index information ... OK > * checking package subdirectories ... OK > * checking R files for non-ASCII characters ... OK > * checking R files for syntax errors ... OK > * loading checks for arch 'i386' > ** checking whether the package can be loaded ... OK > ** checking whether the package can be loaded with stated dependencies ... > OK > ** checking whether the package can be unloaded cleanly ... OK > ** checking whether the namespace can be loaded with stated dependencies > ... OK > ** checking whether the namespace can be unloaded cleanly ... OK > ** checking loading without being on the library search path ... OK > * loading checks for arch 'x64' > ** checking whether the package can be loaded ... OK > ** checking whether the package can be loaded with stated dependencies ... > OK > ** checking whether the package can be unloaded cleanly ... OK > ** checking whether the namespace can be loaded with stated dependencies > ... OK > ** checking whether the namespace can be unloaded cleanly ... OK > ** checking loading without being on the library search path ... OK > * checking dependencies in R code ... OK > * checking S3 generic/method consistency ... OK > * checking replacement functions ... OK > * checking foreign function calls ... OK > * checking R code for possible problems ... OK > * checking Rd files ... OK > * checking Rd metadata ... OK > * checking Rd cross-references ... OK > * checking for missing documentation entries ... OK > * checking for code/documentation mismatches ... OK > * checking Rd \usage sections ... OK > * checking Rd contents ... OK > * checking for unstated dependencies in examples ... OK > * checking line endings in C/C++/Fortran sources/headers ... OK > * checking compiled code ... OK > * checking examples ... > ** running examples for arch 'i386' ... [0s] OK > ** running examples for arch 'x64' ... [0s] OK > * checking PDF version of manual ... OK > * DONE > Status: OK > > R CMD check succeeded > =============================================== > >> Dirk >> | On 22 May 2016 at 12:09, Fran?ois Rousset wrote: >> | | Hi, >> | | >> | | RcppEigen no longer passes the CRAN checks for Windows i386 >> architecture: >> | | https://cran.r-project.org/web/checks/check_results_RcppEigen.html >> | | This problem seems to have appeared in the middle of last month, >> | | presumably following some change on CRAN. >> | | >> | | A similar problem appeared at the same time in some packages I >> maintain, >> | | which link to RcppEigen. For one package, execution stops on a line of >> | | the form >> | | MatrixXd >> | | >> someMatrix(MatrixXd(nb,nb).setZero().selfadjointView().rankUpdate( >> | | anotherMatrix )); >> | | I have reduced the code causing the error to a small reproducible >> | | example, and since I can reproduce the error only on the win-builder >> | | service on CRAN, not on my Windows PC, this example takes the form of >> a >> | | package 'minimalTest'. It can be downloaded from >> | | http://kimura.univ-montp2.fr/~rousset/minimalTest_1.1.3.tar.gz. >> | | >> | | I hope the following may help in correcting RcppEigen (as I think I >> can >> | | circumvent the problem in my package), but I am also curious whether I >> | | am missing some obvious error in my code. >> | | >> | | In this small example, the checks fail (on Windows i386 only; the >> | | relevant part of the check log is pasted at the end of this message) >> | | when executing >> | | >> | | mini(14) >> | | >> | | where the mini() function is >> | | >> | | // [[Rcpp::export]] >> | | int mini( int nb ){ >> | | MatrixXd swZ(nb,nb); >> | | swZ.setZero(); >> | | Rcout <<"Trivial code: >> | | swZ.selfadjointView().rankUpdate(swZ):"<> | | swZ.selfadjointView().rankUpdate(swZ); >> | | Rcout << "after minimal test. "<> error >> | | occurs >> | | return(0); >> | | } >> | | >> | | However, the problem occurs only when two other functions, derived >> from >> | | more meaningful functions in the original package, are included in the >> | | sources (yet are not called by the tests): >> | | >> | | // [[Rcpp::export]] >> | | List unusedFn1( SEXP XX ) { >> | | const MappedSparseMatrix X(as >> >(XX)); >> | | SparseQR, >> | | Eigen::COLAMDOrdering > spQR(X); >> | | SparseMatrix Q_ap(5,5); >> | | Q_ap.setZero(); >> | | List out = List::create(Named("Q_ap") = Q_ap); >> | | return(out); >> | | } >> | | >> | | // [[Rcpp::export]] >> | | SEXP unusedFn2( SEXP ZZ ) { >> | | const Map Z(as >(ZZ)); >> | | int c(Z.cols()); >> | | if (c==0) return(wrap(MatrixXd(0,0))); >> | | MatrixXd bidon(MatrixXd(c,c).setZero()); >> | | MatrixXd >> | | >> swZ(MatrixXd(c,c).setZero().selfadjointView().rankUpdate(bidon.transpose())); >> | | return(wrap(swZ)); >> | | } >> | | >> | | The problem does not occur if either of these two functions is removed >> | | from the sources. I found that I could resolve the problem in my >> | | original package by removing any Eigen::SparseMatrix-related code from >> | | it. Much as in the checks for the small example package, that code was >> | | not called in the checks for my original package. >> | | >> | | The small example package does not contain other C++ or R functions >> | | (except those generated automatically by Rcpp). >> | | >> | | Can anyone make sense of this? >> | >> | The fact that inclusion of other code, which is not called and should be >> | optimized away, is involved is really, really weird. >> | >> | All I can think of so far is maybe some macro going haywire? >> | >> | Dirk >> | >> | | Thanks in advance, >> | | >> | | F.R. >> | | >> | | ============================================== >> | | ** running examples for arch 'i386' ... ERROR >> | | Running examples in 'minimalTest-Ex.R' failed >> | | The error most likely occurred in: >> | | >> | | > base::assign(".ptime", proc.time(), pos = "CheckExEnv") >> | | > ### Name: mini >> | | > ### Title: Test RcppEigen code >> | | > ### Aliases: mini unusedFn1 unusedFn2 >> | | > >> | | > ### ** Examples >> | | > >> | | > sessionInfo() >> | | R Under development (unstable) (2016-05-21 r70655) >> | | Platform: i386-w64-mingw32/i386 (32-bit) >> | | Running under: Windows Server 2008 x64 (build 6002) Service Pack 2 >> | | >> | | locale: >> | | [1] LC_COLLATE=C LC_CTYPE=German_Germany.1252 >> | | [3] LC_MONETARY=C LC_NUMERIC=C >> | | [5] LC_TIME=C >> | | >> | | attached base packages: >> | | [1] stats graphics grDevices utils datasets methods base >> | | >> | | other attached packages: >> | | [1] minimalTest_1.1.3 >> | | >> | | loaded via a namespace (and not attached): >> | | [1] Rcpp_0.12.5 >> | | > mini(14) >> | | Trivial code: swZ.selfadjointView().rankUpdate(swZ): >> | | ** running examples for arch 'x64' ... [1s] OK >> | | * checking PDF version of manual ... OK >> | | * DONE >> | | =============================================== >> | | _______________________________________________ >> | | Rcpp-devel mailing list >> | | Rcpp-devel at lists.r-forge.r-project.org >> | | >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel >> | >> | -- >> | http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org >> | _______________________________________________ >> | Rcpp-devel mailing list >> | Rcpp-devel at 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 at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From francois.rousset at umontpellier.fr Sun May 22 23:31:25 2016 From: francois.rousset at umontpellier.fr (=?UTF-8?Q?Fran=c3=a7ois_Rousset?=) Date: Sun, 22 May 2016 23:31:25 +0200 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> <22338.5010.871572.413549@max.nulle.part> <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> Message-ID: <4431021b-d840-188f-be78-2ccc7f966e72@umontpellier.fr> Le 22/05/2016 ? 22:51, Dan Dillon a ?crit : > > Do you have the same version of mingw as cran? If not , that would be > a good test > I have installed the Rtools 3.3 as described there : https://github.com/rwinlib/r-base which is linked from the "R-devel-experimental" download page https://cran.r-project.org/bin/windows/base/rdevel.html so I am using gcc 4.9.3, and win-builder too. The full win-builder logs for 'minimalTest' are accessible (for ca. 72h) here : http://win-builder.r-project.org/u84hzB80Fol0/ One difference is that win-builder uses -03 : *** arch - i386 d:/Compiler/gcc-4.9.3/mingw_32/bin/g++ -I"D:/RCompile/recent/R/include" -I"d:/RCompile/CRANpkg/lib/3.4/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.4/RcppEigen/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o -mtune=core2 -c RcppExports.cpp -o RcppExports.o (etc) while (for i386) my installation used -02 by default. So I have just changed that on my computer, and the compilation log now reads as *** arch - i386 "C:/Rtools/mingw_32/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -c RcppExports.cpp -o RcppExports.o (etc) but the tests still run without error on my PC. I am not sure whether I should play with other compiler options. F. > On May 22, 2016 3:49 PM, "Fran?ois Rousset" > > wrote: > > Hi, > > Le 22/05/2016 ? 22:16, Dirk Eddelbuettel a ?crit : > > On 22 May 2016 at 09:13, Dirk Eddelbuettel wrote: > | > | Hi Francois, > | > | Thanks for taking the time to track this down and to create > an example. > | I just opened a GitHub issue for it: > | https://github.com/RcppCore/RcppEigen/issues/34 > | Feel free to comment there as well. > > In that thread on GH, Dan raises a good point: what actually > is the supposed > error message? What you have at the end of this long email > isn't all that > clear and _still indirect_: "Running examples in > 'minimalTest-Ex.R' failed" > > For those of us without a windows 32bit machine at hand, can > you (or anybody > else) actually produce an error message? Preferably with > compiler output? > > I never obtained a more useful error message. I have been running > the CRAN checks routinely on my windows PC both for 32 and 64 bit > builds without any problem. Compilation itself does not generate > any particular message. Below are the screen logs on my PC: > > ========================================================= > ==> Rcmd.exe INSTALL --preclean --with-keep.source minimalTest > > * installing to library > 'C:/Users/francois/Documents/R/win-library/3.4' > * installing *source* package 'minimalTest' ... > ** libs > > *** arch - i386 > "C:/Rtools/mingw_32/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" > -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall > -mtune=core2 -c RcppExports.cpp -o RcppExports.o > "C:/Rtools/mingw_32/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" > -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall > -mtune=core2 -c spaMM_linear.cpp -o spaMM_linear.o > C:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o > minimalTest.dll tmp.def RcppExports.o spaMM_linear.o > -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 > -Ld:/Compiler/gcc-4.9.3/local330/lib > -LC:/PROGRA~1/R/R-devel/bin/i386 -lR > installing to > C:/Users/francois/Documents/R/win-library/3.4/minimalTest/libs/i386 > > *** arch - x64 > "C:/Rtools/mingw_64/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" > -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -c > RcppExports.cpp -o RcppExports.o > "C:/Rtools/mingw_64/bin/"g++ -I"C:/PROGRA~1/R/R-devel/include" > -DNDEBUG > -I"C:/Users/francois/Documents/R/win-library/3.4/Rcpp/include" > -I"C:/Users/francois/Documents/R/win-library/3.4/RcppEigen/include" > -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -c > spaMM_linear.cpp -o spaMM_linear.o > C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o > minimalTest.dll tmp.def RcppExports.o spaMM_linear.o > -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 > -Ld:/Compiler/gcc-4.9.3/local330/lib > -LC:/PROGRA~1/R/R-devel/bin/x64 -lR > installing to > C:/Users/francois/Documents/R/win-library/3.4/minimalTest/libs/x64 > ** R > ** byte-compile and prepare package for lazy loading > ** help > *** installing help indices > ** building package indices > ** testing if installed package can be loaded > *** arch - i386 > *** arch - x64 > * DONE (minimalTest) > ========================================================= > ==> Rcmd.exe build minimalTest > > * checking for file 'minimalTest/DESCRIPTION' ... OK > * preparing 'minimalTest': > * checking DESCRIPTION meta-information ... OK > * cleaning src > * checking for LF line-endings in source and make files > * checking for empty or unneeded directories > * building 'minimalTest_1.1.3.tar.gz' > > ==> Rcmd.exe check minimalTest_1.1.3.tar.gz > > * using log directory > 'C:/home/francois/travail/stats/CRANhell/minimalTest.Rcheck' > * using R Under development (unstable) (2016-05-14 r70617) > * using platform: x86_64-w64-mingw32 (64-bit) > * using session charset: ISO8859-1 > * checking for file 'minimalTest/DESCRIPTION' ... OK > * checking extension type ... Package > * this is package 'minimalTest' version '1.1.3' > * package encoding: UTF-8 > * checking package namespace information ... OK > * checking package dependencies ... OK > * checking if this is a source package ... OK > * checking if there is a namespace ... OK > * checking for executable files ... OK > * checking for hidden files and directories ... OK > * checking for portable file names ... OK > * checking whether package 'minimalTest' can be installed ... [21s] OK > * checking installed package size ... OK > * checking package directory ... OK > * checking DESCRIPTION meta-information ... OK > * checking top-level files ... OK > * checking for left-over files ... OK > * checking index information ... OK > * checking package subdirectories ... OK > * checking R files for non-ASCII characters ... OK > * checking R files for syntax errors ... OK > * loading checks for arch 'i386' > ** checking whether the package can be loaded ... OK > ** checking whether the package can be loaded with stated > dependencies ... OK > ** checking whether the package can be unloaded cleanly ... OK > ** checking whether the namespace can be loaded with stated > dependencies ... OK > ** checking whether the namespace can be unloaded cleanly ... OK > ** checking loading without being on the library search path ... OK > * loading checks for arch 'x64' > ** checking whether the package can be loaded ... OK > ** checking whether the package can be loaded with stated > dependencies ... OK > ** checking whether the package can be unloaded cleanly ... OK > ** checking whether the namespace can be loaded with stated > dependencies ... OK > ** checking whether the namespace can be unloaded cleanly ... OK > ** checking loading without being on the library search path ... OK > * checking dependencies in R code ... OK > * checking S3 generic/method consistency ... OK > * checking replacement functions ... OK > * checking foreign function calls ... OK > * checking R code for possible problems ... OK > * checking Rd files ... OK > * checking Rd metadata ... OK > * checking Rd cross-references ... OK > * checking for missing documentation entries ... OK > * checking for code/documentation mismatches ... OK > * checking Rd \usage sections ... OK > * checking Rd contents ... OK > * checking for unstated dependencies in examples ... OK > * checking line endings in C/C++/Fortran sources/headers ... OK > * checking compiled code ... OK > * checking examples ... > ** running examples for arch 'i386' ... [0s] OK > ** running examples for arch 'x64' ... [0s] OK > * checking PDF version of manual ... OK > * DONE > Status: OK > > R CMD check succeeded > =============================================== > > Dirk > | On 22 May 2016 at 12:09, Fran?ois Rousset wrote: > | | Hi, > | | > | | RcppEigen no longer passes the CRAN checks for Windows > i386 architecture: > | | > https://cran.r-project.org/web/checks/check_results_RcppEigen.html > | | This problem seems to have appeared in the middle of last > month, > | | presumably following some change on CRAN. > | | > | | A similar problem appeared at the same time in some > packages I maintain, > | | which link to RcppEigen. For one package, execution stops > on a line of > | | the form > | | MatrixXd > | | > someMatrix(MatrixXd(nb,nb).setZero().selfadjointView().rankUpdate( > | | anotherMatrix )); > | | I have reduced the code causing the error to a small > reproducible > | | example, and since I can reproduce the error only on the > win-builder > | | service on CRAN, not on my Windows PC, this example takes > the form of a > | | package 'minimalTest'. It can be downloaded from > | | > http://kimura.univ-montp2.fr/~rousset/minimalTest_1.1.3.tar.gz > . > | | > | | I hope the following may help in correcting RcppEigen (as > I think I can > | | circumvent the problem in my package), but I am also > curious whether I > | | am missing some obvious error in my code. > | | > | | In this small example, the checks fail (on Windows i386 > only; the > | | relevant part of the check log is pasted at the end of > this message) > | | when executing > | | > | | mini(14) > | | > | | where the mini() function is > | | > | | // [[Rcpp::export]] > | | int mini( int nb ){ > | | MatrixXd swZ(nb,nb); > | | swZ.setZero(); > | | Rcout <<"Trivial code: > | | swZ.selfadjointView().rankUpdate(swZ):"< | | swZ.selfadjointView().rankUpdate(swZ); > | | Rcout << "after minimal test. "< printed when error > | | occurs > | | return(0); > | | } > | | > | | However, the problem occurs only when two other functions, > derived from > | | more meaningful functions in the original package, are > included in the > | | sources (yet are not called by the tests): > | | > | | // [[Rcpp::export]] > | | List unusedFn1( SEXP XX ) { > | | const MappedSparseMatrix > X(as >(XX)); > | | SparseQR, > | | Eigen::COLAMDOrdering > spQR(X); > | | SparseMatrix Q_ap(5,5); > | | Q_ap.setZero(); > | | List out = List::create(Named("Q_ap") = Q_ap); > | | return(out); > | | } > | | > | | // [[Rcpp::export]] > | | SEXP unusedFn2( SEXP ZZ ) { > | | const Map Z(as >(ZZ)); > | | int c(Z.cols()); > | | if (c==0) return(wrap(MatrixXd(0,0))); > | | MatrixXd bidon(MatrixXd(c,c).setZero()); > | | MatrixXd > | | > swZ(MatrixXd(c,c).setZero().selfadjointView().rankUpdate(bidon.transpose())); > | | return(wrap(swZ)); > | | } > | | > | | The problem does not occur if either of these two > functions is removed > | | from the sources. I found that I could resolve the problem > in my > | | original package by removing any > Eigen::SparseMatrix-related code from > | | it. Much as in the checks for the small example package, > that code was > | | not called in the checks for my original package. > | | > | | The small example package does not contain other C++ or R > functions > | | (except those generated automatically by Rcpp). > | | > | | Can anyone make sense of this? > | > | The fact that inclusion of other code, which is not called > and should be > | optimized away, is involved is really, really weird. > | > | All I can think of so far is maybe some macro going haywire? > | > | Dirk > | > | | Thanks in advance, > | | > | | F.R. > | | > | | ============================================== > | | ** running examples for arch 'i386' ... ERROR > | | Running examples in 'minimalTest-Ex.R' failed > | | The error most likely occurred in: > | | > | | > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > | | > ### Name: mini > | | > ### Title: Test RcppEigen code > | | > ### Aliases: mini unusedFn1 unusedFn2 > | | > > | | > ### ** Examples > | | > > | | > sessionInfo() > | | R Under development (unstable) (2016-05-21 r70655) > | | Platform: i386-w64-mingw32/i386 (32-bit) > | | Running under: Windows Server 2008 x64 (build 6002) > Service Pack 2 > | | > | | locale: > | | [1] LC_COLLATE=C LC_CTYPE=German_Germany.1252 > | | [3] LC_MONETARY=C LC_NUMERIC=C > | | [5] LC_TIME=C > | | > | | attached base packages: > | | [1] stats graphics grDevices utils datasets > methods base > | | > | | other attached packages: > | | [1] minimalTest_1.1.3 > | | > | | loaded via a namespace (and not attached): > | | [1] Rcpp_0.12.5 > | | > mini(14) > | | Trivial code: swZ.selfadjointView().rankUpdate(swZ): > | | ** running examples for arch 'x64' ... [1s] OK > | | * checking PDF version of manual ... OK > | | * DONE > | | =============================================== > | | _______________________________________________ > | | Rcpp-devel mailing list > | | Rcpp-devel at lists.r-forge.r-project.org > > | | > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > | > | -- > | http://dirk.eddelbuettel.com | @eddelbuettel | > edd at debian.org > | _______________________________________________ > | Rcpp-devel mailing list > | Rcpp-devel at 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 at lists.r-forge.r-project.org > > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Sun May 22 23:59:02 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Sun, 22 May 2016 16:59:02 -0500 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <4431021b-d840-188f-be78-2ccc7f966e72@umontpellier.fr> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> <22338.5010.871572.413549@max.nulle.part> <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> <4431021b-d840-188f-be78-2ccc7f966e72@umontpellier.fr> Message-ID: <22338.11174.926295.685335@max.nulle.part> On 22 May 2016 at 23:31, Fran?ois Rousset wrote: | Le 22/05/2016 ? 22:51, Dan Dillon a ?crit?: | | | Do you have the same version of mingw as cran?? If not , that would be a | good test | | I have installed the Rtools 3.3 as described there : | https://github.com/rwinlib/r-base | which is linked from the "R-devel-experimental" download page | https://cran.r-project.org/bin/windows/base/rdevel.html | so I am using gcc 4.9.3, and win-builder too. | | The full win-builder logs for 'minimalTest' are accessible (for ca. 72h) here : | http://win-builder.r-project.org/u84hzB80Fol0/ There is almost nothing there. It builds, and then on i386 we get a run-time error and it shows is > mini(14) Trivial code: swZ.selfadjointView().rankUpdate(swZ): from http://win-builder.r-project.org/u84hzB80Fol0/examples_and_tests/minimalTest-Ex_i386.Rout and the summary in http://win-builder.r-project.org/u84hzB80Fol0/00check.log Can you expand on it? Decompose the expressesion? Compare it to alternate versions of the same expression? Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From francois.rousset at umontpellier.fr Mon May 23 01:14:03 2016 From: francois.rousset at umontpellier.fr (=?UTF-8?Q?Fran=c3=a7ois_Rousset?=) Date: Mon, 23 May 2016 01:14:03 +0200 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <22338.11174.926295.685335@max.nulle.part> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> <22338.5010.871572.413549@max.nulle.part> <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> <4431021b-d840-188f-be78-2ccc7f966e72@umontpellier.fr> <22338.11174.926295.685335@max.nulle.part> Message-ID: <86478cea-938f-b3ea-55b0-078dfcd575d1@umontpellier.fr> Le 22/05/2016 ? 23:59, Dirk Eddelbuettel a ?crit : > On 22 May 2016 at 23:31, Fran?ois Rousset wrote: > | Le 22/05/2016 ? 22:51, Dan Dillon a ?crit : > | > | > | Do you have the same version of mingw as cran? If not , that would be a > | good test > | > | I have installed the Rtools 3.3 as described there : > | https://github.com/rwinlib/r-base > | which is linked from the "R-devel-experimental" download page > | https://cran.r-project.org/bin/windows/base/rdevel.html > | so I am using gcc 4.9.3, and win-builder too. > | > | The full win-builder logs for 'minimalTest' are accessible (for ca. 72h) here : > | http://win-builder.r-project.org/u84hzB80Fol0/ > > There is almost nothing there. It builds, and then on i386 we get a run-time > error and it shows is > > > mini(14) > Trivial code: swZ.selfadjointView().rankUpdate(swZ): > > from http://win-builder.r-project.org/u84hzB80Fol0/examples_and_tests/minimalTest-Ex_i386.Rout > and the summary in http://win-builder.r-project.org/u84hzB80Fol0/00check.log > > Can you expand on it? Decompose the expressesion? Compare it to alternate > versions of the same expression? I don't know how to decompose it further in more elementary steps. I can surely compute a cross-product in a different way. However, having submitted 131 versions of packages to win-builder in the last week in order to produce the small example, and given how slow using win-builder makes any debugging attempt, I wish someone would be able to reproduce the problem on another machine, or else to give me more specific advice as to what alternative versions of the code would be most useful to test, because I feel have reached the point where my limited understanding of Eigen and RcppEigen's internals makes the blind testing exercise too inefficient. F. From edd at debian.org Mon May 23 02:32:26 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Sun, 22 May 2016 19:32:26 -0500 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <86478cea-938f-b3ea-55b0-078dfcd575d1@umontpellier.fr> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> <22338.5010.871572.413549@max.nulle.part> <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> <4431021b-d840-188f-be78-2ccc7f966e72@umontpellier.fr> <22338.11174.926295.685335@max.nulle.part> <86478cea-938f-b3ea-55b0-078dfcd575d1@umontpellier.fr> Message-ID: <22338.20378.50827.602615@max.nulle.part> On 23 May 2016 at 01:14, Fran?ois Rousset wrote: | Le 22/05/2016 ? 23:59, Dirk Eddelbuettel a ?crit : | > On 22 May 2016 at 23:31, Fran?ois Rousset wrote: | > | Le 22/05/2016 ? 22:51, Dan Dillon a ?crit : | > | | > | | > | Do you have the same version of mingw as cran? If not , that would be a | > | good test | > | | > | I have installed the Rtools 3.3 as described there : | > | https://github.com/rwinlib/r-base | > | which is linked from the "R-devel-experimental" download page | > | https://cran.r-project.org/bin/windows/base/rdevel.html | > | so I am using gcc 4.9.3, and win-builder too. | > | | > | The full win-builder logs for 'minimalTest' are accessible (for ca. 72h) here : | > | http://win-builder.r-project.org/u84hzB80Fol0/ | > | > There is almost nothing there. It builds, and then on i386 we get a run-time | > error and it shows is | > | > > mini(14) | > Trivial code: swZ.selfadjointView().rankUpdate(swZ): | > | > from http://win-builder.r-project.org/u84hzB80Fol0/examples_and_tests/minimalTest-Ex_i386.Rout | > and the summary in http://win-builder.r-project.org/u84hzB80Fol0/00check.log | > | > Can you expand on it? Decompose the expressesion? Compare it to alternate | > versions of the same expression? | I don't know how to decompose it further in more elementary steps. I can | surely compute a cross-product in a different way. | However, having submitted 131 versions of packages to win-builder in the | last week in order to produce the small example, and given how slow | using win-builder makes any debugging attempt, I wish someone would be | able to reproduce the problem on another machine, or else to give me | more specific advice as to what alternative versions of the code would | be most useful to test, because I feel have reached the point where my | limited understanding of Eigen and RcppEigen's internals makes the blind | testing exercise too inefficient. Understood. I suggest we may want to put this on hold. Many people have spent time on it, you surely the most, __but we are left without a reproducible example__ even on very similar setups (ie Kevin's, your's outside of win-builder). Until there is something actionable, I don't intend to spend more time on this. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org From yixuan.qiu at cos.name Mon May 23 03:36:38 2016 From: yixuan.qiu at cos.name (Yixuan Qiu) Date: Mon, 23 May 2016 09:36:38 +0800 Subject: [Rcpp-devel] RcppEigen fails on win-builder i386, and a possibly related issue. In-Reply-To: <22338.20378.50827.602615@max.nulle.part> References: <45872af1-7d0d-ecd8-7737-f8cff60cdefe@umontpellier.fr> <22337.48785.425157.848058@max.nulle.part> <22338.5010.871572.413549@max.nulle.part> <1ddd900e-ed8a-b3ee-eb68-906375853920@umontpellier.fr> <4431021b-d840-188f-be78-2ccc7f966e72@umontpellier.fr> <22338.11174.926295.685335@max.nulle.part> <86478cea-938f-b3ea-55b0-078dfcd575d1@umontpellier.fr> <22338.20378.50827.602615@max.nulle.part> Message-ID: Hi all, I just double checked the compilation flag on win-builder. It turns out that it uses -O3 as Fran?ois pointed out, and also the -DNDEBUG flag is NOT defined, unlike the default configuration shipped with R for windows. Under these conditions, the issue can actually be reproduced. I'm not sure whether this is a bug of MinGW or of Eigen, but at least we can start from here to investigate. (I would suggest future discussions moving to https://github.com/RcppCore/RcppEigen/issues/34) Best, Yixuan -- Yixuan Qiu Department of Statistics, Purdue University From drewboyette at gmail.com Fri May 27 20:11:20 2016 From: drewboyette at gmail.com (Drew Boyette) Date: Fri, 27 May 2016 14:11:20 -0400 Subject: [Rcpp-devel] Rcpp - External Libraries Message-ID: I'm currently collaborating with several other professors on a C++ evolutionary-based model, and my task is to find a way to run the program in R. In our model, we utilized the SNAP library ( https://snap.stanford.edu/snap/) to simulate social network dynamics and generate graphs. My question is, will this require us to build a separate R package to implement the necessary functions from SNAP, or is there simpler way of accomplishing this? I know there are examples of building R packages using external libraries with Rcpp, but I'm fairly new to Rcpp and I was hoping for a clear explanation of how this works, and I wanted to make sure whether it's necessary to build a package in R. Thanks, Drew B -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Fri May 27 21:09:36 2016 From: edd at debian.org (Dirk Eddelbuettel) Date: Fri, 27 May 2016 14:09:36 -0500 Subject: [Rcpp-devel] Rcpp - External Libraries In-Reply-To: References: Message-ID: <22344.39792.846556.481100@max.nulle.part> Hi Drew, On 27 May 2016 at 14:11, Drew Boyette wrote: | I'm currently collaborating with several other professors on a C++ | evolutionary-based model, and my task is to find a way to run the program in R. | In our model, we utilized the SNAP library (https://snap.stanford.edu/snap/) to | simulate social network dynamics and generate graphs. My question is, will this | require us to build a separate R package to implement the necessary functions | from SNAP, or is there simpler way of accomplishing this? I know there are | examples of building R packages using external libraries with Rcpp, but I'm | fairly new to Rcpp and I was hoping for a clear explanation of how this works, | and I wanted to make sure whether it's necessary to build a package in R.? First off, in general "it all depends" on the particularities of the library. This is not a 'answered in one sentence' topic, which is why we have entire vignette devoted to it. Second, glancing at Snap's own Makefile in snap-core at https://github.com/snap-stanford/snap/blob/master/snap-core/Makefile you may be able to get by with building libsnap.a as part of the package and then using it. Not a beginner's topic. Third, I vaguely recalled having seen Snap in the context R before, and a quick Google search resulting in finding https://cloud.r-project.org/web/packages/influenceR/index.html Maybe you can study their setup? We can help you with more specific Rcpp questions. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org