Re: [Rcpp-devel] Default empty values for vector and matrices

2014-02-17 Thread Romain Francois
Le 17 févr. 2014 à 12:17, Alessandro Mammana a écrit : > Dear all, > I am trying to write an Rcpp function that accepts optionally a > vector, but I cannot figure out what default value I should give to > it. > > First I tried the following: > > // [[Rcpp::export]] > int nilVec(NumericVector v

Re: [Rcpp-devel] Deriving type information

2014-02-13 Thread Romain François
it is embarrasing to ask because I believe Romain has > already answered it; just can't find the answer) how to derive the what type > "a" should have once we know RTYPE?? > > My second question is: Isn't there an easier general way to write the > dispatch func

Re: [Rcpp-devel] Array into C++ with cppFunction

2014-02-12 Thread Romain Francois
FYI, there is a Array template in Rcpp11. https://github.com/romainfrancois/Rcpp11/blob/master/inst/include/Rcpp/Array.h With which you could use code like this: #include using namespace Rcpp ; // [[Rcpp::export]] double NewFunc( NumericArray<3> x){ return x(1,2,3) + x(2,3,4) ; }

Re: [Rcpp-devel] Segfault, is it because of iterators/pointers?

2014-02-12 Thread Romain Francois
Le 12 févr. 2014 à 13:36, Alessandro Mammana a écrit : > Ah wait, my bad (as always T.T), I found a much simpler explanation: > > colset <- sample(3e7-nr, 1e7) > storage.mode(colset) > [1] "integer" > storage.mode(colset-1) > [1] "double" > > So when I was unwrapping colset I allocated new mem

Re: [Rcpp-devel] calling and R function from rcpp and evaluation

2014-02-06 Thread Romain Francois
er/R/manip-df.r And the C++ logic is mostly in DataDots.h https://github.com/hadley/dplyr/blob/master/inst/include/tools/DataDots.h Romain Le 6 févr. 2014 à 02:07, Antonio Piccolboni a écrit : > Hi, > I was wondering why I can serialize a call such as in > > serialize(call("r

Re: [Rcpp-devel] Package built with Rcpp fails to install

2014-02-03 Thread Romain Francois
> src/*.so > src/*.dll > So I suspect that the versions are indeed the same. > > Kevin - thanks. > > Romain - > I am glad you have an idea for what the problem might be. However, I am not > sure I understand how to proceed in fixing it. > > > Since the

Re: [Rcpp-devel] Package built with Rcpp fails to install

2014-02-03 Thread Romain Francois
The problem is likely to be that it was assumed that List derives from RObject. It used to, it does not anymore. Classes from the api now use a policy based design. See andrei alexandrescu's modern c++ book for the why and the how of policy based design. . Envoyé de mon iPhone Le 3 févr.

Re: [Rcpp-devel] Wierd compilation error

2014-01-29 Thread Romain François
The attributes parser does not know how to handle the static keyword. Works for me without it. You get the line number of the generated file. Use verbose = TRUE to have a better clue at what is wrong. Romain Le 29 janv. 2014 à 12:24, Alessandro Mammana a écrit : > Hi all, >

Re: [Rcpp-devel] Rcpp and required steps before next release

2014-01-28 Thread Romain François
Just don’t assume you can #include anything else than Rcpp.h and RcppCommon.h (but this one only if you need to provide custom wrap and as). Romain Le 28 janv. 2014 à 17:24, Steffen Neumann a écrit : > Hi, > > I just pushed mzR-1.9.4 to BioC-SVN, which only required a cha

Re: [Rcpp-devel] is_na, is_infinite etc

2014-01-22 Thread Romain François
This is not implemented as members of Vector. See: https://github.com/RcppCore/Rcpp/blob/b5ff9b5530e4a82682caab5ddc87ac23a7b8857e/inst/include/Rcpp/traits/is_infinite.h So, you can use: traits::is_infinite(x) Romain Le 23 janv. 2014 à 00:07, Søren Højsgaard a écrit : > Dear all, >

Re: [Rcpp-devel] Rcpp version of c( )

2014-01-21 Thread Romain François
): - compatible primitive (i.e. double in the case of NumericVector) - arbitrary compatible sugar expression It is at least for now a static member function of the Vector class. Maybe it can be made a free function. This is about 90 lines of C++11 code. Romain Le 22 janv. 2014 à 01:37, Søren Højsgaard a

Re: [Rcpp-devel] Rcpp version of c( )

2014-01-21 Thread Romain François
C++11 so it might not fit until R 3.1.0 is > out with its C++11 support, but it could be a natural fit in Rcpp11. > Adding the generic version in Rcpp would require code bloat > unfortunately. This might be fun to produce with C++11, but a massive pain with C++98. Romain > -Kevi

Re: [Rcpp-devel] Rcpp version of c( )

2014-01-21 Thread Romain François
nt to go further and want something with multiple inputs. Interesting idea, I guess lots of work to generalize it. Romain Le 21 janv. 2014 à 23:02, Søren Højsgaard a écrit : > Dear all, > > I have made the following primitive "concatenate" function, because I

Re: [Rcpp-devel] RcppMLPACK ?

2014-01-20 Thread Romain Francois
Hello, Do you have a budget fo that work ? Romain Le 20 janv. 2014 à 11:12, Damian Lyons a écrit : > Dear Rcpp developers, > > Firstly, many thanks for your work on Rcpp. It has saved me countless hours > (or is that months?) of simulation time. > > I'm a big f

Re: [Rcpp-devel] A strange question while using Rcpp

2014-01-19 Thread Romain Francois
Hello, This stands out double U; for(int i=0; i(X); NumericVector y = as(Y); … } by things like this: //[[Rcpp::export]] double mydcov(NumericVector x, NumericVector y){ … } Romain Le 19 janv. 2014 à 14:09, 晔张 a écrit : > Hello, everyone. > I guess the probrem maybe

Re: [Rcpp-devel] Bug: compileAttributes incorrectly handles Rcpp::export-ed functions with multiple arguments

2014-01-18 Thread Romain Francois
I gave about Rcp. I guess [.]c(c|pp)$ would make a better pattern. WRE says (if you read between the lines) that c++ files are .cpp or .cc So this is a bug. Romain > You need a better way to identify C++ sources. R-exts manual says R’s make > rules use .cc and .cpp for C++. (This is s

Re: [Rcpp-devel] vector < RawVector > to RawMatrix [like do.call(rbind, mylist)]

2014-01-10 Thread Romain Francois
instead of creating a vector of RawVector. Romain Le 10 janv. 2014 à 10:51, "Sven E. Templer" a écrit : > Hello, > > reading a matrix from a file and transforming it to raw format, I get a > "std::vector< Rcpp::RawVector >", how can I wrap it to "

Re: [Rcpp-devel] Question about modules

2014-01-09 Thread Romain Francois
not really. the std::is_enum trait in C++11 is going to help, but not that much. Romain Le 9 janv. 2014 à 19:02, Tim Keitt a écrit : > Thanks. Got it working. Looks very promising. > > Any progress/work-arounds for enums? I have a ton to deal with. > > THK > > >

Re: [Rcpp-devel] Question about modules

2014-01-09 Thread Romain Francois
Hi, The module docs is probably the one in the worst shape. I think the current recommendation is to have this in one of your .R files: loadModule( "yourmodule", TRUE ) which triggers a load action for when the package is loaded. Romain Le 9 janv. 2014 à 17:45, Tim Keitt a écr

Re: [Rcpp-devel] Question about modules

2014-01-09 Thread Romain Francois
Hello, You can use .factory instead of .constructor in that case. Romain Le 9 janv. 2014 à 03:16, Tim Keitt a écrit : > I did a little experiment with RCPP_MODULE trying to wrap a class from > another library. The class in question has a protected default constructor > and u

Re: [Rcpp-devel] Problems wrapping stl::vector

2014-01-03 Thread Romain Francois
: return wrap< std::vector >( a ) ; wrap returns a « SEXP » (any R object) which can be used by an IntegerVector constructor. So you can do: IntegerVector x( wrap(a) ) ; or even: IntegerVector = as( wrap(a) ) ; Romain Le 3 janv. 2014 à 17:18, Alessandro Mammana a écrit : > Dear all

Re: [Rcpp-devel] What is the most efficient method to check if a Rcpp vector contains an element?

2013-12-31 Thread Romain Francois
Thanks. In any case, for things like this the best thing to do is to not trust what anyone says and actually benchmark with realistic data. Romain Le 31 déc. 2013 à 16:29, Hadley Wickham a écrit : >> I believe you are mistaken. sorting is an expensive O( N log(N) ) operation. >

Re: [Rcpp-devel] exporting void test(void) function

2013-12-31 Thread Romain Francois
. Romain Le 31 déc. 2013 à 05:15, Tim Keitt a écrit : > Apologies if this is the wrong list for user questions -- happy to be > redirected -- I did not see it immediately. > > Am I correct in noting that > > // [[Rcpp::export]] > void test(void) > { > // do

Re: [Rcpp-devel] How to speed up selection of unique unordered pairs

2013-12-30 Thread Romain Francois
but probably not the same as yours. I would still expect this code to perform better to your 29 seconds. Romain Le 30 déc. 2013 à 19:01, Asis Hallab a écrit : > Dear Rcpp experts, > > I need to select all unique un-ordered pairs from a two column table. > Here each row represents a pair

Re: [Rcpp-devel] calling a homegrown cpp function from my own package when using sourceCpp

2013-12-30 Thread Romain Francois
you want. Romain Le 30 déc. 2013 à 02:59, Søren Højsgaard a écrit : > Dear all, > > I have created a function c++ function foo which I export with > //[[Rcpp::export]]. I've put the file foo.cpp with the function into the src > dir of the package mypack; I've run co

Re: [Rcpp-devel] What is the most efficient method to check if a Rcpp vector contains an element?

2013-12-29 Thread Romain Francois
something like std::find (or std::any_of if you use C++11). Those are O(N) Otherwise, you might like Rcpp::any or Rcpp::any_of Romain > What would be the Rcpp solution for the same task on a Rcpp vector? > Should I convert my Rcpp Vector to a std::vector and do the above, as > explai

Re: [Rcpp-devel] how to create an Rcpp::List in a standalone C++ application?

2013-12-18 Thread Romain François
Hi, You need to embed R and load Rcpp, otherwise this won’t work. You can do this either from scratch. See http://cran.r-project.org/doc/manuals/R-exts.html#Embedding-R-under-Unix_002dalikes Or you can use RInside. Romain Le 18 déc. 2013 à 12:12, Florian Oswald a écrit : > Hi All, >

Re: [Rcpp-devel] How many copies of my object do I make?

2013-12-10 Thread Romain François
It does not do deep copy of your data. wrap(dMat) causes copy of the eigen representation into an R representation. This makes data copy. wrap returns a SEXP. When this SEXP gets into Xout, no copy is done. Romain > Put differently, if my input matrix occupies B bytes of memory, how many >

Re: [Rcpp-devel] RcppEigen needs 1GB memory to compile

2013-12-03 Thread Romain Francois
in a | JSS paper? We could add a 'Suggests: RcppEigenFastLm' (or whichever name we end up with). It would help with a thing or too -- didn't you even discover a slight NAMESPACE issue on the R side recently? On 3 December 2013 at 08:47, Romain Francois wrote: | without them, w

Re: [Rcpp-devel] RcppEigen needs 1GB memory to compile

2013-12-02 Thread Romain Francois
utside of the package, kind of like "look how I can do fastLm with this one". This has been useful in training sessions for example. But now presumably, I'll get replies in the "this has been there for years" department. Romain -- R

Re: [Rcpp-devel] linking error when using matrices?

2013-11-25 Thread Romain Francois
Have you compiled Rcpp from source ? If not, are you compiling with the same compiler that was used to compile Rcpp. The cran binary for Rcpp 0.10.6 was built with llvm-g++ wherehas preseumably you are using clang now on Mavericks. Please try compiling Rcpp from source. Romain Le 26/11

Re: [Rcpp-devel] Header-only version of Rcpp provides a couple of gotcha's in RcppEigen

2013-11-14 Thread Romain Francois
es/R/x86_64-unknown-linux-gnu-library/3.1/Rcpp/include/Rcpp/exceptions.h:172:17: note: 'Rcpp::forward_exception_to_r' declared here inline void forward_exception_to_r( const std::exception& ex){ ^ Do these all look like issues that I should address in RcppEigen? -- R

Re: [Rcpp-devel] Header-only version of Rcpp provides a couple of gotcha's in RcppEigen

2013-11-14 Thread Romain Francois
are usually called through the BEGIN_RCPP / END_RCPP or nowadays by compileAttributes. Do these all look like issues that I should address in RcppEigen? This seems more like Rcpp issues. However I'll propose a few changes to RcppEigen so that it uses at

Re: [Rcpp-devel] RcppArmadillo and the version of Rcpp

2013-11-07 Thread Romain Francois
removing 'C:/Program Files/R/R-2.15.1/library/RcppArmadillo' Any advice would be much appreciated. Thanks Greg -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] How much speedup for matrix operations?

2013-11-06 Thread Romain Francois
This very much depends on the code but there is a good chance that RcppArmadillo will generate code making less data copies, etc ... Hard to say without seeing the code. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcp

Re: [Rcpp-devel] Rcpp and RcppArmadillo errors on OSX Mavericks

2013-11-04 Thread Romain Francois
ee below, it is likely to be the extent of the problem. Romain I'm using the pre-built R binary CRAN provides. Nothing fancy. XCode 5.0.1 is installed along with the Command Line Tools (OS X Mavericks) and gfortran-4.2.3 from CRAN.) I ran the the unit tests for RcppArmadillo, they a

Re: [Rcpp-devel] Attribute does not compile with 'compileAttributes' but with 'sourceCpp'

2013-11-02 Thread Romain Francois
compileAttributes ends up calling a .Call function that lives inside Rcpp.so. Le 2 nov. 2013 à 10:25, Simon Zehnder a écrit : > Thanks Romain, > > looks the same here. So the path is the same, but it seems, that the padding > is different. I would like to understand what happens

Re: [Rcpp-devel] Attribute does not compile with 'compileAttributes' but with 'sourceCpp'

2013-11-02 Thread Romain Francois
th -- Chief Scientist, RStudio http://had.co.nz/ ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 __

Re: [Rcpp-devel] Fwd: CRAN packages with C++ compilation errors on OS X 10.9

2013-10-31 Thread Romain Francois
Le 31/10/2013 17:36, Dirk Eddelbuettel a écrit : On 31 October 2013 at 17:15, Romain Francois wrote: | Le 31/10/2013 15:59, baptiste auguie a écrit : | > "OS X 10.9 (aka Mavericks) has a new C++ compiler, clang++ with libcxx | > headers/runtime. Your package fails to compile with th

Re: [Rcpp-devel] Fwd: CRAN packages with C++ compilation errors on OS X 10.9

2013-10-31 Thread Romain Francois
ch trivial uses of modules (i.e. no classes), maybe it is worth considering using // [[Rcpp::export]] and code generation given by compileAttributes instead of modules. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___

Re: [Rcpp-devel] Fwd: CRAN packages with C++ compilation errors on OS X 10.9

2013-10-31 Thread Romain Francois
I'll have a look. It is likely to be a bug in some part of Rcpp's code bloat. I will try to find a solution that does not involve releasing a new Rcpp as 0.10.6 was just released. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 _

Re: [Rcpp-devel] Rcpp/C++ serialization of R objects?

2013-10-29 Thread Romain Francois
re details if needed... I am doing some long-running MCMC calculations. And, I would like the C++ code to store the results every, say, 1 iterations. Of course, I could do this in a loop from R. But, I want to be sure that is really necessary before I re-write my R code ;o) -- Romain Fra

Re: [Rcpp-devel] ListOf -- update

2013-10-29 Thread Romain Francois
Hi, I'll review this when I get a chance. If we include this in Rcpp, it will have to be split into at least two files. Everything that uses wrap or as has to go in meat. Romain Le 29/10/2013 05:02, Kevin Ushey a écrit : Hi guys, With some encouragement from Romain, I took a sh

Re: [Rcpp-devel] inline error

2013-10-28 Thread Romain Francois
Just a warning that this code creates a NumericVector of length 1 initialised with 0. 1 is not a NumericVector so the compiler looks for a conversion, the one that is found is the ctor for NumericVector that takes an int. Romain Le 28 oct. 2013 à 17:05, Hadley Wickham a écrit : >

Re: [Rcpp-devel] Problems getting RInside to work on OS X

2013-10-26 Thread romain
Hi, What does this give you: $ R CMD config CXX $ R CMD config CXXFLAGS What happens in an R console when you type: require(devtools) has_devel() Romain Le 2013-10-27 06:02, Claymore M a écrit : I am trying to get RInside to run on my mac (Mavericks). (I was able to get RInline running

Re: [Rcpp-devel] feature proposal: ListOf

2013-10-26 Thread romain
will. -Kevin On Fri, Oct 25, 2013 at 12:00 PM, Romain Francois wrote: Cool. I've got lots on my plate right now, so this is not a priority. Did you have a chance to look at the (simplistic) implementation of ListOf in dplyr: https://github.com/hadley/dplyr/blob/master/inst/include/tools/Lis

Re: [Rcpp-devel] feature proposal: ListOf

2013-10-25 Thread Romain Francois
andle assignments, i.e.: NumericVector z ; ListOf x( xxx ); x[0] = z ; At the moment it only has read access because that's all I needed for now in dplyr. So maybe if we wanted something more generic in Rcpp, this should be designed a bit more. Romain Le 25/10/2013 20:40, Kevin Ush

Re: [Rcpp-devel] Exporter.h cannot convert 'SEXP' to 'const std::vector*' in initialization

2013-10-23 Thread Romain Francois
ter to a function that is Rcpp::export'ed, what happens is that the data gets copied. Could you instead pass down an NumericVector ? The reason is that given Rcpp's design, copy semantics of NumericVector are cheap (no data copy). Which leads back

Re: [Rcpp-devel] feature proposal: ListOf

2013-10-23 Thread Romain Francois
Le 23/10/2013 13:47, Dirk Eddelbuettel a écrit : On 21 October 2013 at 14:32, Romain Francois wrote: | Hello, | | Another thing I have developped in dplyr but might be generally useful | is the ListOf class. See | https://github.com/hadley/dplyr/blob/master/inst/include/tools/ListOf.h | | The

Re: [Rcpp-devel] max length of Rcpp::List is 20 elements?

2013-10-23 Thread Romain Francois
nserter["x29"] = 32 ; You can probably encapsulate more so that you don't have to create the 3 objects (out, names and inserter), but I leave this as an exercize. This is not as nice as using create, but it gets the job done in a way that does not compro

Re: [Rcpp-devel] Redirecting cout/cerr streams to Rprintf

2013-10-23 Thread Romain Francois
(){ Sinker bar ; // call whatever that uses cout } Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp

[Rcpp-devel] feature proposal: ListOf

2013-10-23 Thread Romain Francois
list and SO, but could be generally useufl for Rcpp users. Do people want to see this in Rcpp. This is orthogonal to everything else, so the risk is minimum. This is a template class, so the cost is null if the class is not used. Romain -- Romain Francois Professional R Enthusiast +33(0) 6

Re: [Rcpp-devel] Local .h files and Rcpp attributes

2013-10-23 Thread Romain Francois
Le 19/10/13 22:06, JJ Allaire a écrit : For it to actually work though we'd need to modify Makevars as well (as Romain pointed out) so that the RcppExports.cpp could see the include file. IMO, R should do this. R should recognize that a package has a inst/include directory and automati

Re: [Rcpp-devel] Local .h files and Rcpp attributes

2013-10-23 Thread Romain Francois
wrote: | For it to actually work though we'd need to modify Makevars as well (as Romain | pointed out) so that the RcppExports.cpp could see the include file. This might | get trickly. Well right now we simply set people up to fail / having to create it themselves. Rcpp.package.skeleton() ha

Re: [Rcpp-devel] Local .h files and Rcpp attributes

2013-10-19 Thread Romain Francois
Le 19/10/13 20:09, Dirk Eddelbuettel a écrit : On 19 October 2013 at 17:55, Romain Francois wrote: | Try putting your declarations into a RItools.h file in inst/include/ or | src/ in your package, i.e. have this in RItools.h | | typedef double (*testStat)(NumericVector, NumericVector); | | and

Re: [Rcpp-devel] Local .h files and Rcpp attributes

2013-10-19 Thread Romain Francois
p Thanks in advance, -M Hello, Try putting your declarations into a RItools.h file in inst/include/ or src/ in your package, i.e. have this in RItools.h typedef double (*testStat)(NumericVector, NumericVector); and add: PKG_CPPFLAGS += -I../inst/include/ to your Makevars and Makevars.win. R

Re: [Rcpp-devel] sourceCpp failing on windows whereas devtools::has_devel and devtools:::R works

2013-10-17 Thread romain
Le 2013-10-17 16:49, JJ Allaire a écrit : I think the reason Dirks configuration worked is that he added Rtools to the path during installation. If Romain didnt do this, then sourceCpp goes looking for Rtools 2.15 or 2.16 (the initial development version for R 3.0) and doesnt find it. I just

[Rcpp-devel] sourceCpp failing on windows whereas devtools::has_devel and devtools:::R works

2013-10-17 Thread romain
t fails is these lines: cmd <- paste(R.home(component = "bin"), .Platform$file.sep, "R ", "CMD SHLIB ", "-o ", shQuote(context$dynlibFilename), " ", ifelse(rebuild, "--preclean ", ""), shQuote(context$

Re: [Rcpp-devel] Rcpp Makevars COPYING policy?

2013-10-16 Thread Romain Francois
ist::create( host::foo(2.), host::fun() ) ; return res ; } That's it. The code generated by compileAttributes takes care of registering and retrieving the functions. Romain Le 16/10/13 04:34, Jonathan Olmsted a écrit : Finally, some closure... Romain, as you s

Re: [Rcpp-devel] Rcpp Makevars COPYING policy?

2013-10-15 Thread Romain Francois
Le 15/10/13 21:27, Jonathan Olmsted a écrit : Dirk and Romain (in the order listed in the file mentioned below), Intellectual property rights confuse the heck out of me so I wanted to ask explicitly before stepping on any toes. Rcpp is GPL-2. However, the Makevars in the ./src/ directory don&#

Re: [Rcpp-devel] Calling an internal do_* C level function

2013-10-15 Thread Romain Francois
Le 15/10/13 10:46, Martyn Plummer a écrit : On Mon, 2013-10-14 at 22:24 +0200, Romain Francois wrote: Le 14/10/13 21:47, Mark Fredrickson a écrit : Thank you to Romain and Dirk. I've seen some C++ rank implementations, and I'll probably copy one of those. Lastly, not a milligr

Re: [Rcpp-devel] Calling an internal do_* C level function

2013-10-14 Thread Romain Francois
Le 14/10/13 21:47, Mark Fredrickson a écrit : Thank you to Romain and Dirk. I've seen some C++ rank implementations, and I'll probably copy one of those. Lastly, not a milligram of Rcpp in this question. Plain R programming questions should go to r-devel, not rcpp-devel.

Re: [Rcpp-devel] Issue with Matrices and Iterators

2013-10-14 Thread Romain Francois
ze that this is in fact an algorithm from the STL: accumulate, so you can do something like this; // [[Rcpp::export]] double sumFirstRowSTL(NumericMatrix mat){ return std::accumulate(mat(0,_).begin(), mat(0,_).end(), 0.0); } Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 9

Re: [Rcpp-devel] Calling an internal do_* C level function

2013-10-14 Thread Romain Francois
e code over to their project. It might be appropriate for you. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] calling R function triggers tryCatch() ???

2013-10-14 Thread Romain Francois
ng the internal dplyr tools, we can definitely make a fast flexible rowApply that would call optimized code when recognizing known patterns and fall back to the R interpreter otherwise. Romain Le 11/10/13 16:27, Hadley Wickham a écrit : Interestingly, that shows that rowApply2 is actually slig

Re: [Rcpp-devel] Rcpp11 testing

2013-10-13 Thread Romain Francois
Le 13/10/13 20:47, Dominick Samperi a écrit : Hello Romain, I tested Rcpp11 under Mac OS (10.8.5) using Apple's clang-500.2.75 (Xcode 5), and also under Linux. Here are some results: 1. The recommended install method devtools::install_github("romainfrancois/Rcpp11") di

Re: [Rcpp-devel] calling R function triggers tryCatch() ???

2013-10-11 Thread Romain Francois
the same size. I will contribute code versions of these hints later. Romain Le 11 oct. 2013 à 16:27, Hadley Wickham a écrit : > Interestingly, that shows that rowApply2 is actually slightly _slower_ > than rowApply1. > > Hadley > > On Fri, Oct 11, 2013 at 9:24 AM, Hadley W

Re: [Rcpp-devel] Armor, Shield and Shelter.

2013-10-11 Thread Romain Francois
Le 11/10/13 13:26, Dirk Eddelbuettel a écrit : Romain, On 11 October 2013 at 13:03, Romain Francois wrote: | Anyway, I'd like to propose adding Shield, Armor and Shleter to Rcpp. Sure. | This is a non disruptive proposal as the template classes I propose | don't interract with t

[Rcpp-devel] Armor, Shield and Shelter.

2013-10-11 Thread Romain Francois
to UNPROTECT in the .h and .cpp of Rcpp. That is that many macro calls we could get rid of. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forg

Re: [Rcpp-devel] [Summary] (Was: question re: LdFlags, RcppLdFlags

2013-10-10 Thread Romain Francois
Le 10/10/13 19:00, Dirk Eddelbuettel a écrit : On 10 October 2013 at 18:30, Romain Francois wrote: | Rcpp::register attribute so that compileAttributes would also generate | the registration code. So I don't need to use nm anyway. At that point you can register the 'extern "C&

Re: [Rcpp-devel] [Summary] (Was: question re: LdFlags, RcppLdFlags

2013-10-10 Thread Romain Francois
Le 10/10/13 18:16, Dirk Eddelbuettel a écrit : On 10 October 2013 at 18:02, Romain Francois wrote: | To give some context, I'm taking about using R's linking mechanism. I'm | talking about generating automatically the code that: | - registers a function with R_RegisterCCallabl

Re: [Rcpp-devel] [Summary] (Was: question re: LdFlags, RcppLdFlags

2013-10-10 Thread Romain Francois
Le 10/10/13 17:36, Dirk Eddelbuettel a écrit : On 10 October 2013 at 17:15, Romain Francois wrote: | They are quite useful for debugging too: | | #if RCPP_DEBUG_LEVEL > 0 | #define RCPP_DEBUG( fmt, ... ) Rprintf( "%20s:%4d " fmt "\n" | , short_file_n

Re: [Rcpp-devel] [Summary] (Was: question re: LdFlags, RcppLdFlags

2013-10-10 Thread Romain Francois
Le 10/10/13 16:51, Dirk Eddelbuettel a écrit : To bring a bit of closure to this endless thread: It appear from his commit logs that Romain made the change in his dplyRcpp project we are now supposed to make per R Core: Demote packages from Depends: to Imports:, and import what is needed. That

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
Le 10/10/13 04:54, Dirk Eddelbuettel a écrit : On 10 October 2013 at 04:02, Romain Francois wrote: | Le 10/10/13 03:53, Dirk Eddelbuettel a écrit : | > Ack. If the set of functions is small and rarely changes, then registration | > using R's mechanism is indeed fine. Worked so far

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
Le 10/10/13 03:53, Dirk Eddelbuettel a écrit : On 10 October 2013 at 03:29, Romain Francois wrote: | Whoever who wants to use the classes it defines. dplyrRcpp exists mainly | for facilitating the implementation of dplyr, but some of the concepts | are general and could be used as building

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
Le 10/10/13 03:21, Dirk Eddelbuettel a écrit : On 10 October 2013 at 02:56, Romain Francois wrote: | Le 10/10/13 02:41, Dirk Eddelbuettel a écrit : | > | > (Combining two of your emails) | > | > On 10 October 2013 at 01:08, Romain Francois wrote: | > | RcppGSL does not export its

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
Le 10/10/13 02:41, Dirk Eddelbuettel a écrit : (Combining two of your emails) On 10 October 2013 at 01:08, Romain Francois wrote: | RcppGSL does not export its LdFlags, if it did, you'd see the warning | when you load it. Good catch ... but turns out I don't (to my surprise).

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
Le 10/10/13 00:14, Dirk Eddelbuettel a écrit : On 10 October 2013 at 00:05, Romain Francois wrote: | That will then quickly become a mess. Having the convention | package:::LdFlags() was fine. I agree. It was a perfectly legit use of ::: but then the powers of CRAN do other things do we don&#

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
ration for GNU GSL vectors and matrices -Version: 0.2.0.2 +Version: 0.2.0.3 Date: $Date$ Author: Romain Francois and Dirk Eddelbuettel Maintainer: Dirk Eddelbuettel @@ -27,8 +27,8 @@ write a similar package against another library. License: GPL (>= 2) LazyLoad: yes -Imports: Rcpp (&g

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
Le 09/10/13 23:43, Dirk Eddelbuettel a écrit : On 9 October 2013 at 23:13, Romain Francois wrote: | Le 09/10/13 03:41, Dirk Eddelbuettel a écrit : | > | > On 8 October 2013 at 16:53, Dirk Eddelbuettel wrote: | > | | This is also what's done in e.g. Rcpp.package.skeleton. However,

Re: [Rcpp-devel] question re: LdFlags, RcppLdFlags

2013-10-09 Thread Romain Francois
dplyrRcpp. Would it perhaps make sense to think about standard ways for R packages to register what they need. We have a system like this for inline plugins, maybe it would be interesting to move this up in R and let packages communicate in some way (perhaps in DESCRIPTION) what they need

Re: [Rcpp-devel] RcppOctave on Windows: testing needed

2013-10-08 Thread Romain Francois
Le 08/10/13 17:12, Dominick Samperi a écrit : That is interesting Romain, but the linking complexity remains for derived packages like RcppOctave, and especially for derived packages that export their C/C++ functions to clients (unless these derived packages can also place all C++ code in header

Re: [Rcpp-devel] RcppOctave on Windows: testing needed

2013-10-08 Thread Romain Francois
Le 08/10/13 16:21, Dirk Eddelbuettel a écrit : On 8 October 2013 at 15:58, Romain Francois wrote: | But I fear that because too many depend on the current setting (Makevars, | Makevars.win, making a library and non portably link against it) it is not | likely to happen. As I see it, if one

Re: [Rcpp-devel] RcppOctave on Windows: testing needed

2013-10-08 Thread Romain Francois
are depending on C++11, which would make it possible to use the same strategy for Rcpp too. But I fear that because too many depend on the current setting (Makevars, Makevars.win, making a library and non portably link against it) it is not likely to happen. Romain Le 08/10/13 15:47, Domi

Re: [Rcpp-devel] Rcpp vector classes vs std::vector for custom class member variables

2013-10-08 Thread Romain Francois
Le 08/10/13 14:53, Jon Clayden a écrit : Thanks Dirk and Romain for your helpful replies. To follow up briefly... I'm defining a custom class, an object of which will need to survive across various calls back and forth between R and C++, so I plan to use the

Re: [Rcpp-devel] Rcpp vector classes vs std::vector for custom class member variables

2013-10-08 Thread Romain Francois
x27;t sure if it was worth dusting off my slightly rusty C++ for. Suffice to say I think it was. The API is very clean and returning to the standard R API will be painful...! Great. You don't need expert knowledge of C++ for Rcpp to be useful. --

Re: [Rcpp-devel] calling R function triggers tryCatch() ???

2013-10-03 Thread Romain Francois
h just calls R's Rf_eval. If you go down this road, you have to make sure your function does not generate R errors. Romain debug(tryCatch); then, apply(M, 1L, mean) [1] 7 8 9 we see that apply(, 1L, ) runs just fine (without calling things like tryCatch() ). UNFORTUNATELY: ro

Re: [Rcpp-devel] inconsistent is_na() vs. is.na()

2013-10-02 Thread Romain Francois
Hi, The question is that do we want to be consistent with R or do we want something that makes sense. I believe that is_na should test if its argument is NA, and is_nan should check if is NaN Romain Le 02/10/13 13:31, Thomas Tse a écrit : Hi, is_na() does not handles R's NaN corr

Re: [Rcpp-devel] api/meat/is.h missing CharacterVector and CharacterMatrix

2013-10-02 Thread Romain Francois
tion in Rcpp, we would have to fully specify for arma::mat, arma::cx_mat, ... The only c++11 thing here is the use of std::conditional, but Rcpp has traits::if_ do do the same. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___

Re: [Rcpp-devel] Defining template specialisation for wrap on Windows 64bit (Compilation error: 'result_type' does not name a type)

2013-10-01 Thread Romain Francois
Renaud, Are you by any chance using cywin ? This is not likely to fly. To check if this is an octave problem, what happens when you do: > evalCpp( "2+2" ) Romain Le 01/10/13 17:20, Renaud Gaujoux a écrit : Hi, I wanted to "quickly" port my package RcppOctave to run o

[Rcpp-devel] handling ellipsis (...) in attributes exposed functions

2013-10-01 Thread Romain Francois
dots, env ) } and its c++: // [[Rcpp::export]] IntegerVector order_impl( List args, Environment env ){ int nargs = args.size() ; SEXP tmp ; List variables(nargs) ; LogicalVector ascending(nargs) ; for(int i=0; iAnyway. I just wanted to start a discussion about this. Would people

Re: [Rcpp-devel] Understanding the behaviour of const CharacterVector as a function parameter

2013-09-29 Thread Romain Francois
Le 29/09/13 20:36, Simon Zehnder a écrit : Hi Romain, thanks for this fix! On Sep 29, 2013, at 5:26 PM, Romain Francois wrote: Hello, What acts as a proxy for const CharacterVector& does not do its proxy job. Instead it gives direct access to the underlying array of SEXP that chara

Re: [Rcpp-devel] Understanding the behaviour of const CharacterVector as a function parameter

2013-09-29 Thread Romain Francois
Le 29/09/13 20:36, Simon Zehnder a écrit : Hi Romain, thanks for this fix! On Sep 29, 2013, at 5:26 PM, Romain Francois wrote: Hello, What acts as a proxy for const CharacterVector& does not do its proxy job. Instead it gives direct access to the underlying array of SEXP that chara

Re: [Rcpp-devel] Understanding the behaviour of const CharacterVector as a function parameter

2013-09-29 Thread Romain Francois
ts more strict compatibility requirements. Romain Le 29/09/13 15:24, Romain Francois a écrit : Le 29/09/13 14:06, Simon Zehnder a écrit : Dear Rcpp::Users and Rcpp::Devels, I would like to understand a certain behaviour of my code I encountered lately. I am working with CharacterVector and

Re: [Rcpp-devel] Understanding the behaviour of const CharacterVector as a function parameter

2013-09-29 Thread Romain Francois
e result of charv(0) to a char*. Probably worth looking at the string_proxy class. Romain Using a string like "2013-05-04 20:23:21" for the Rcpp::CharacterVector gives the following outputs: test1: 2013-05-04 20:23:21 test2: ` This does also not change if I use a cast to const ch

Re: [Rcpp-devel] Please help! A list containing dataframe

2013-09-27 Thread Romain Francois
hat weights about 14666 lines in Rcpp. Romain Le 27/09/13 16:12, Mark Clements a écrit : This can be done more generally. Following an earlier suggestion from Romain, we can use boost::tuple from the BH package - for a row of fixed size with general types. Then we can use a template to read in

Re: [Rcpp-devel] Please help! A list containing dataframe

2013-09-27 Thread Romain Francois
the data frame. Prior to that we fill the vector "row" with data using the fill_row function. Then it is just looping, etc ... The apply_all is just a convenience that will apply apply_row_df to each item of a list. Hope this helps. Romain -- Romain Francois Professional R Enthusi

Re: [Rcpp-devel] Struggling with cppFunction() and clusterExport()

2013-09-27 Thread Romain Francois
internally. The object could carry with it its definition and compile itself if the pointer is the null pointer, which is what you get apparently. Unless things have evolved in R, there is no way to control how an external pointer is serialized and reloaded. Romain On Thu, Sep 26, 2013 at

Re: [Rcpp-devel] Struggling with cppFunction() and clusterExport()

2013-09-26 Thread Romain Francois
ws how to compile itself, for example: > fun <- auto_function(' double inner_Cpp(double a){ return 1; } ' ) # this takes a while the first time > fun( 2 ) [1] 1 # this is instant thanks to caching of sourceCpp > fun( 2 ) [1] 1 Romain Le 26/09/13 18:57, Matteo Fasiolo a é

Re: [Rcpp-devel] Problem exposing inherited member function of derived class to R through RCPP_MODULE

2013-09-24 Thread Romain Francois
pedef. See the code in this gist: https://gist.github.com/romainfrancois/6695921 Romain Le 25/09/13 06:30, luke.doman...@csiro.au a écrit : Hi All, Thanks for your previous help on http://comments.gmane.org/gmane.comp.lang.r.rcpp/5972 I have been able to implement an RCPP_MODULE of the “real

<    1   2   3   4   5   6   7   8   9   10   >