Re: [Rcpp-devel] Code review for xtensor R bindings

2017-06-07 Thread Romain Francois
Hi, Instead of doing that: const int vtype = traits::r_sexptype_traits::rtype; SEXP shape_sxp = Rf_allocVector(vtype, shape.size()); Perhaps your rxarray object could hold an IntegerVector. Also not quite sure why you use the first line at all, which does not depend on T, so vtype is always

Re: [Rcpp-devel] starter

2017-05-31 Thread Romain Francois
ared identifier 'output' > output.begin() + begin, > ^ > 2 errors generated. > make: *** [par_example.o] Error 1 > > > Hope this is as easily solved as the before error. > > Cheers, Franz > > > > >> On 31 May 2017, at 12:26, Romain Francois &l

Re: [Rcpp-devel] starter

2017-05-31 Thread Romain Francois
You can add this somewhere on top of your cpp file // [[Rcpp::depends(RcppParallel)]] Romain > Le 31 mai 2017 à 12:22, f.k...@mailbox.org a écrit : > > Hi all, > > I am very new to Rcpp and I wrote a function which I now want to parallelize. > The function is working fine, and is much faster

Re: [Rcpp-devel] Rcpp sugar for double?

2017-02-22 Thread Romain Francois
Hello, Functions in sugar only apply to vectors. For a single value, you’d have to use the dnorm function in the R:: namespace: // [[Rcpp::export]] double test6(double x){ double y = R::dnorm(x,5.0,2.0,true); return y; } > test6(3) [1] -2.112086 > dnorm(3, mean = 5, sd = 2, log = TRUE)

Re: [Rcpp-devel] Rcpp Timer

2016-12-30 Thread Romain Francois
| Hi Kaspar and Dirk, > | > | It is indeed cumulative. Previously (presumably when that gallery page was > | written) it was not cumulative, but Romain Francois changed the behavior of > the > | step() function several years ago, in this commit: > https

Re: [Rcpp-devel] Rcpp ISNAN slower than C ISNAN?

2016-12-13 Thread Romain Francois
I’d be interesting to see what this more C++idomatic version would perform nanCount = std::count_if( x.begin(), x.end(), ISNAN ) ; Because despite all the inlining efforts that has been put in the implementation of NumericVector, its operator[] might not perform as well as using [] on a

Re: [Rcpp-devel] Specify Rcpp header location in Makevars

2015-07-29 Thread Romain Francois
You need LinkingTo: Rcpp As per the current documentation. Romain Envoyé de mon iPhone Le 29 juil. 2015 à 17:19, jsmith5...@yahoo.com jsmith5...@yahoo.com a écrit : Hi, Is there a way to automatically specify the location of the Rcpp include directory (for Rcpp.h) in Makevars?

Re: [Rcpp-devel] When calling same Rcpp function several times different results are returned

2015-07-14 Thread Romain Francois
Or just use a std::vectordouble for sg. That should do it. Romain Envoyé de mon iPhone Le 14 juil. 2015 à 13:21, JJ Allaire jj.alla...@gmail.com a écrit : The examples in the RcppParallel documentation assume that access to vectors and matrixes are *aligned* (i.e. fall into neat buckets

Re: [Rcpp-devel] On Developing Header Packages

2015-04-07 Thread Romain Francois
I would definitely second that. This eliminates a whole class of hard to deal with issues. Even Rcpp IMO should really just be header only. Romain Envoyé de mon iPhone Le 7 avr. 2015 à 20:51, JJ Allaire jj.alla...@gmail.com a écrit : I think that header-only packages (where possible)

Re: [Rcpp-devel] assert() for Rcpp?

2015-02-20 Thread Romain Francois
Envoyé de mon iPhone Le 18 févr. 2015 à 17:31, JJ Allaire jj.alla...@gmail.com a écrit : We *can* call Rf_error from C++ code, but when we do it bypasses all C++ destructors on the stack, so we don't do it so as not leak memory and otherwise have deterministic behavior around

Re: [Rcpp-devel] String encoding (UTF-8 conversion)

2014-12-15 Thread Romain Francois
That is similar to a path i've followed in Rcpp11/Rcpp14. What's really missing in R is api access to strings, e.g testing for equality of two CHARSXP, comparing them, ... This causes all sorts of problems with dplyr. Romain Le 16 déc. 2014 à 06:00, Jeroen Ooms jeroen.o...@stat.ucla.edu a

Re: [Rcpp-devel] Returning an arma vec

2014-12-03 Thread Romain Francois
Envoyé de mon iPhone Le 3 déc. 2014 à 17:59, Gabor Grothendieck ggrothendi...@gmail.com a écrit : 1. This returns a matrix rather than a vector: -- start of file teste.cpp --- #include RcppArmadillo.h // [[Rcpp::depends(RcppArmadillo)]] using namespace arma; using namespace Rcpp;

Re: [Rcpp-devel] Const correctness of NumericVector iterators

2014-11-27 Thread Romain Francois
This is probably related to this: template int RTYPE struct r_vector_const_iterator { typedef typename storage_typeRTYPE::type* type ; }; There should be a const there somewhere. FWIW, more modern implementations of R/C++ are more safe on that issue:

Re: [Rcpp-devel] Indexing vector with x(i) and x[i] gives remarkable difference in computing time

2014-11-27 Thread Romain Francois
Le 27 nov. 2014 à 13:22, Søren Højsgaard sor...@math.aau.dk a écrit : Dear all, By accident I noticed that indexing with x(i) and x[i] gives remarkable difference in computing time. For example: library(Rcpp) cppFunction(' IntegerVector insert1 (int n){ IntegerVector z(n); for

Re: [Rcpp-devel] sugar: x+y and y+x gives different results when there are NA's in y

2014-11-22 Thread Romain Francois
This has nothing to do with NA. It's just about the size difference. sugar does not make attempt at recycling. Your responsibility. Romain Le 22 nov. 2014 à 11:48, Søren Højsgaard sor...@math.aau.dk a écrit : Dear all, Came across this: #include Rcpp.h using namespace Rcpp;

Re: [Rcpp-devel] sugar: x+y and y+x gives different results when there are NA's in y

2014-11-22 Thread Romain Francois
You get UB if the first is bigger than the second. Envoyé de mon iPhone Le 22 nov. 2014 à 14:30, Søren Højsgaard sor...@math.aau.dk a écrit : OK; thanks! Shall I read this such as the behaviour is undefined? Søren |-Original Message- |From: Romain Francois [mailto:rom...@r

Re: [Rcpp-devel] inplace modification more affect other varibles

2014-10-22 Thread Romain Francois
a and b are the same object: a - seq(1, 0.1, -0.1) b - a pryr::address( a ) [1] 0x7f9504534948 pryr::address( b ) [1] 0x7f9504534948 So clone is what you need here. Implementing copy on write for that kind of example is possible, but would require a lot of additional code, i.e. the

Re: [Rcpp-devel] inplace modification more affect other varibles

2014-10-22 Thread Romain Francois
...@gmail.com a écrit : Thanks a lot! Does that mean we should never modify an argument passed from R to cpp? On Wed, Oct 22, 2014 at 8:24 AM, Romain Francois rom...@r-enthusiasts.com mailto:rom...@r-enthusiasts.com wrote: a and b are the same object: a - seq(1, 0.1, -0.1) b - a pryr

Re: [Rcpp-devel] convert to unsigned char* variable

2014-10-20 Thread Romain Francois
Le 20 oct. 2014 à 21:54, Dirk Eddelbuettel e...@debian.org a écrit : Hi Gustaf, On 20 October 2014 at 15:17, Gustaf Granath wrote: | Im trying to use some C++ functions in R. However, these functions are | build around unsigned char* variables (1D array). I have for example a |

Re: [Rcpp-devel] convert to unsigned char* variable

2014-10-20 Thread Romain Francois
Hi, that's not going to fly. A CharacterVector holds strings of arbitrary lengths, well technically it holds other R objects (SEXP) that hold pointers to strings. A RawVector holds unsigned char. Can you add some meat to your example, e.g. what you'd expect to go in, etc ... Romain Le

Re: [Rcpp-devel] Grid Search in RcppParallel

2014-10-05 Thread Romain Francois
Envoyé de mon iPhone Le 5 oct. 2014 à 07:51, Jeffrey Wong jeff.ct.w...@gmail.com a écrit : I am trying to use RcppParallel to do a fast grid search. The idea is to construct a matrix using R's expand.grid, then for each row of that matrix, x, call f(x). For simplicity the function f

Re: [Rcpp-devel] statement about rcpp11 ?

2014-09-29 Thread Romain Francois
If you want to have a private conversation with Dirk, just email him directly: e...@debian.org Now since this is all in the open, let me participate to this. Le 29 sept. 2014 à 22:42, Jonathon Love j...@thon.cc a écrit : -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 hey dirk, i was

Re: [Rcpp-devel] Pass an Rcpp module object to a method belonging to another module from R?

2014-09-10 Thread Romain Francois
This is once again something with which the RCPP_EXPOSED_CLASS macro can help with. Try adding RCPP_EXPOSED_CLASS(A) before you declare class A and simply use this signature for the method. void DoSomethingWithInstanceOfA(const A ) Also, you can have both of these classes in the same

Re: [Rcpp-devel] Pass an Rcpp module object to a method belonging to another module from R?

2014-09-10 Thread Romain Francois
Le 10 sept. 2014 à 14:22, Gregory Jefferis jeffe...@mrc-lmb.cam.ac.uk a écrit : Gregory Jefferis On 10 Sep 2014, at 10:39, Romain Francois rom...@r-enthusiasts.com wrote: RCPP_EXPOSED_CLASS(A) before you declare class A and simply use this signature for the method. void

Re: [Rcpp-devel] RcppModules with templated class

2014-09-01 Thread Romain Francois
Le 1 sept. 2014 à 11:48, Dr Gregory Jefferis jeffe...@mrc-lmb.cam.ac.uk a écrit : Hello, I have a more or less complete Rcpp(Eigen) dependent package that exposes a pair of C++ classes to R using RcppModules;the C++ classes (which implement k nearest neighbour search trees) differ only

Re: [Rcpp-devel] (Very) rare segfault

2014-08-21 Thread Romain Francois
Le 20 août 2014 à 20:57, Gregor Kastner gregor.kast...@wu.ac.at a écrit : JJ Yes, RNGScope isn't safe by itself. You can use it via attributes (and we JJ make sure to use it correctly) or you could use this pattern e.g. if you JJ are planning to return a NumericVector: JJ JJ NumericVector

Re: [Rcpp-devel] (Very) rare segfault

2014-08-21 Thread Romain Francois
Le 21 août 2014 à 11:47, Gregor Kastner gregor.kast...@wu.ac.at a écrit : On Thu, 21 Aug 2014 11:34:23 +0200 Romain Francois rom...@r-enthusiasts.com wrote: GK Yep, sorry for the misuse of language. And I do understand going back to GK GetRNGstate() and PutRNGstate() is a bit old school

Re: [Rcpp-devel] (Very) rare segfault

2014-08-21 Thread Romain Francois
are using attributes then this isn't a concern, if you are not then you need the return value SEXP on the stack prior to RNGScope. On Thursday, August 21, 2014, Romain Francois rom...@r-enthusiasts.com wrote: Ah interesting. PutRNGstate does indeed allocate so might trigger GC. https://github.com

Re: [Rcpp-devel] Typecasting bug in Rcpp::List (generic_name_proxy) when using clang

2014-07-29 Thread Romain Francois
This is likely to be a bug in Rcpp, don't go bother clang about it:) Perhaps you can try to remove the bool cast and run the test suite. If everything works, then it either means that there are no tests for the particular case or that the overload is useless. You probably have to consider what

Re: [Rcpp-devel] Typecasting bug in Rcpp::List (generic_name_proxy) when using clang

2014-07-29 Thread Romain Francois
*** Number of test functions: 439 Number of errors: 0 Number of failures: 0 Sorry, due to a restrictive firewall on my dev computer, I cannot access github from it. A mail will have to suffice for now. Ciao, Christian On 29.07.2014 10:44, Romain Francois

Re: [Rcpp-devel] Faster lookup: Named Rcpp::List or std::map?

2014-07-23 Thread Romain Francois
Lookup in Rcpp::List is linear on something that is quite cheap (comparing pointers, because strings in R are cached). Lookup in std::map is logarithmic on whatever it means to compare the keys (so in your case comparing strings). on top of that, copying the data across is linear in the best

Re: [Rcpp-devel] Raise a condition

2014-06-18 Thread Romain Francois
Le 18 juin 2014 à 23:54, Tim Keitt tke...@utexas.edu a écrit : I'd like to raise a condition other than error or warning. Is that possible using the Rcpp api? I assume this can be done via R internals, but I'd prefer not to call error() directly (or is that the recommendation?). THK

Re: [Rcpp-devel] Raise a condition

2014-06-18 Thread Romain Francois
Le 19 juin 2014 à 00:15, Tim Keitt tke...@utexas.edu a écrit : On Wed, Jun 18, 2014 at 5:07 PM, Romain Francois rom...@r-enthusiasts.com wrote: Le 18 juin 2014 à 23:54, Tim Keitt tke...@utexas.edu a écrit : I'd like to raise a condition other than error or warning. Is that possible

Re: [Rcpp-devel] Raise a condition

2014-06-18 Thread Romain Francois
Le 19 juin 2014 à 00:30, Tim Keitt tke...@utexas.edu a écrit : On Wed, Jun 18, 2014 at 5:22 PM, Romain Francois rom...@r-enthusiasts.com wrote: Le 19 juin 2014 à 00:15, Tim Keitt tke...@utexas.edu a écrit : On Wed, Jun 18, 2014 at 5:07 PM, Romain Francois rom...@r-enthusiasts.com

Re: [Rcpp-devel] Raise a condition

2014-06-18 Thread Romain Francois
Le 19 juin 2014 à 01:02, Tim Keitt tke...@utexas.edu a écrit : On Wed, Jun 18, 2014 at 5:37 PM, Romain Francois rom...@r-enthusiasts.com wrote: Le 19 juin 2014 à 00:30, Tim Keitt tke...@utexas.edu a écrit : On Wed, Jun 18, 2014 at 5:22 PM, Romain Francois rom...@r-enthusiasts.com

Re: [Rcpp-devel] Raise a condition

2014-06-18 Thread Romain Francois
Le 19 juin 2014 à 03:05, Dirk Eddelbuettel e...@debian.org a écrit : On 18 June 2014 at 19:40, Tim Keitt wrote: | | | | On Wed, Jun 18, 2014 at 6:26 PM, Dirk Eddelbuettel e...@debian.org wrote: | | | Tim, | | Step back for a second and recognise that everything happens

Re: [Rcpp-devel] Error during wrapup

2014-05-28 Thread Romain Francois
This looks like a protection issue. For whomever this makes sense to: From the code that wraps such object, i would investigate the call to setAttrib. Perhaps we are supposed to get the result of it and protect it. So i would tend to use an Armor instead of a Shield. Romain Le 28 mai

Re: [Rcpp-devel] Error during wrapup

2014-05-28 Thread Romain Francois
(now with some links): Le 28 mai 2014 à 16:31, John Mous john.mo...@gmail.com a écrit : The object really is just built as part of the return statement. i.e. the lines from my prior e-mail exist as-is in the full code, Sure. What happens is that Rcpp::export generates something that calls

Re: [Rcpp-devel] Error during wrapup

2014-05-28 Thread Romain Francois
On Wed, May 28, 2014 at 3:44 PM, Romain Francois rom...@r-enthusiasts.com wrote: (now with some links): Le 28 mai 2014 à 16:31, John Mous john.mo...@gmail.com a écrit : The object really is just built as part of the return statement. i.e. the lines from my prior e-mail exist as-is in the full

Re: [Rcpp-devel] Questions on extending Rcpp wrap and as with templates

2014-05-06 Thread Romain Francois
Le 6 mai 2014 à 08:45, Florian Burkart florian.burk...@gmail.com a écrit : Hi everyone (and Dirk), Second attempt on corrected email list. I have been trying to extend Rcpp with my own wrap and as templates. Two issues: 1) I need to explicitly call wrap. Is that expected? So for

Re: [Rcpp-devel] How to create list of list without known structure

2014-05-06 Thread Romain Francois
Le 6 mai 2014 à 09:35, Florian Burkart florian.burk...@gmail.com a écrit : Hi, I have been creating lists of lists with return Rcpp::List::create(Rcpp::Named(vec) = someVector, Rcpp::Named(lst) = someList, Rcpp::Named(vec2) =

Re: [Rcpp-devel] g++ flags

2014-04-30 Thread Romain Francois
I've tested and it seems to work as intended. Is this fix you were conceiving of or is there something more we should be doing? J.J. On Wed, Apr 30, 2014 at 9:19 AM, Romain Francois rom...@r-enthusiasts.com wrote: The plugin as implemented now is not portable. The easiest way to make

Re: [Rcpp-devel] Parallel random numbers using Rcpp and OpenMP

2014-04-28 Thread Romain Francois
Hi, If you can assume c++11, you might bot need openmp, as you can just use standard support for threads, etc ... Although the compiler suite used on windows (if you care about that) does not support c++11 threads. This might be available later. Romain Le 28 avr. 2014 à 12:51, Matteo

[Rcpp-devel] Rcpp11 3.1.0 is on CRAN

2014-04-11 Thread Romain Francois
Hello, I’ll keep it short here. Rcpp11 3.1.0 was released on CRAN today. An announcement email has been sent to both r-packages and the new R and C++ mailing list. https://groups.google.com/forum/#!forum/r-and-cpp Best Regards, Romain ___

Re: [Rcpp-devel] Generic R and C++ discussion

2014-04-08 Thread Romain Francois
Le 8 avr. 2014 à 13:28, stat quant mail.statqu...@gmail.com a écrit : Hi, Will that be ok to ask Rcpp questions to on this list too? Definitely. Anything R and C++ related. On 8 Apr 2014 09:56, Romain François rom...@r-enthusiasts.com wrote: Hello, I have created a new mailing list

Re: [Rcpp-devel] Rcpp syntactic sugar equivalent for R's optimize() function

2014-02-28 Thread Romain Francois
Le 28 févr. 2014 à 11:52, Gregor Kastner gregor.kast...@wu.ac.at a écrit : Hi Hideyoshi, Is there a way I can just call that function in Rcpp rather than having to install new libraries or create my own? (I presume that there is probably a “C_do_fmin.c” file somewhere that I can use?)

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 mamm...@molgen.mpg.de 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

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 mamm...@molgen.mpg.de 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

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

2014-02-06 Thread Romain Francois
Hi Antonio, This is about how R evaluation works. Might not just be what you think it is. When you use Rcpp and therefore .Call things are evaluated fairly early, at least earlier than what would happen with R, etc … you can reproduce what R does by using promises. For example this work in

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] Package built with Rcpp fails to install

2014-02-03 Thread Romain Francois
) -- On Mon, Feb 3, 2014 at 9:12 PM, Romain Francois rom...@r-enthusiasts.com wrote: 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

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; in; i++){ for(int j=0; jn; j++){ U = U + A_kl(i,j) * B_kl(i,j)/n/n ; } } U = sqrt(U); U is not initialized. so all bets are on. Anything can happen. Same holds for aa and bb. Also, in terms of how you

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

2014-01-18 Thread Romain Francois
Le 18 janv. 2014 à 06:10, Davor Cubranic cubra...@stat.ubc.ca a écrit : Running compileAttributes with “verbose = TRUE” was very informative: $ Rscript -e 'Rcpp::compileAttributes(., TRUE)' Exports from /Users/davor/projects/Davor/myPackage/src/rcpp_hello_world.cpp: List

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

2014-01-10 Thread Romain Francois
Hi, If you wrap your std::vectorRawVector you get a list of raw vectors, and this does not do deep copies of the RawVector. If you want a RawMatrix, you have to make copies as all the matrix data is contiguous in memory. Perhaps you can change things around, first create the matrix and

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 tke...@utexas.edu 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

Re: [Rcpp-devel] Question about modules

2014-01-09 Thread Romain Francois
of my functions exported to the package. How would the factory be called from R? I sort of understood that exporting in packages was automatic. Do I have to manually create the module in R? THK On Thu, Jan 9, 2014 at 4:40 AM, Romain Francois rom...@r-enthusiasts.com wrote: Hello

Re: [Rcpp-devel] Question about modules

2014-01-09 Thread Romain Francois
, 2014 at 11:31 AM, Romain Francois rom...@r-enthusiasts.com wrote: 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

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

2014-01-03 Thread Romain Francois
Hello, wrap is for converting an object of arbitrary class to an R object. It deduces what to do based on the class of what you pass it. So you usually don’t specify the template parameter. So you’d usually just write : return wrap(a); If you wanted to be explicit, then you would use:

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

2013-12-31 Thread Romain Francois
Hello, This is fixed in Rcpp implementations I maintain: Rcpp11 and Rcpp98 and tested for in Rcpp-test. https://github.com/romainfrancois/Rcpp11/blob/master/src/attributes.cpp#L1195 https://github.com/romainfrancois/Rcpp98/blob/master/src/attributes.cpp#L1228 Trivial to port the fix to Rcpp.

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 h.wick...@gmail.com a écrit : I believe you are mistaken. sorting is an expensive O( N log(N) )

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

2013-12-30 Thread Romain Francois
Hi, If both these functions will end up in the same package, then I’d suggest to put both files in the src directory and use devtools::load_all on your package root directory. Dirk’s recommendation is relevant bar is in its own package and calls foo from another package. Might not be what

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

2013-12-29 Thread Romain Francois
Le 29 déc. 2013 à 12:50, Asis Hallab asis.hal...@gmail.com a écrit : Dear Rcpp experst, I hope everyone has had a pleasant Xmas. I am just wondering what would be the recommended and most efficient way to check, if a Rcpp Vector contains a given element? If I am not mistaken the C++

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, we (you) could

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

2013-12-02 Thread Romain Francois
, 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 -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30

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

2013-11-25 Thread Romain Francois
on OS X 10.9 with R 3.0.2 and Rcpp 0.10.6. Does anyone know how to fix this? Best, -- Hao Ye h...@ucsd.edu -- 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

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

2013-11-14 Thread Romain Francois
? This seems more like Rcpp issues. However I'll propose a few changes to RcppEigen so that it uses attributes. I'll make a branch and send a pull request so that you can validate it. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30

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

2013-11-14 Thread Romain Francois
void forward_exception_to_r( const std::exception ex){ ^ Do these all look like issues that I should address in RcppEigen? -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcpp-devel mailing list Rcpp-devel@lists.r

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

2013-11-07 Thread Romain Francois
-- 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
, etc ... Hard to say without seeing the code. 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

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

2013-11-04 Thread Romain Francois
-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- 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] Attribute does not compile with 'compileAttributes' but with 'sourceCpp'

2013-11-02 Thread Romain Francois
-bin/mailman/listinfo/rcpp-devel -- 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] Attribute does not compile with 'compileAttributes' but with 'sourceCpp'

2013-11-02 Thread Romain Francois
happens when I call compileAttributes. Is there anywhere a linking involved with Rcpp.so or Rcpp.dylib? Best Simon On 02 Nov 2013, at 09:57, Romain Francois rom...@r-enthusiasts.com wrote: Le 02/11/2013 09:35, Simon Zehnder a écrit : First, I didn’t. But for getting some output

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

2013-10-31 Thread Romain Francois
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 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r

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

2013-10-31 Thread Romain Francois
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 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org

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 that compiler

Re: [Rcpp-devel] ListOf -- update

2013-10-29 Thread Romain Francois
, add_1NumericVector); Thanks! -Kevin -- 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] Rcpp/C++ serialization of R objects?

2013-10-29 Thread Romain Francois
necessary before I re-write my R code ;o) -- 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] 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 h.wick...@gmail.com a

Re: [Rcpp-devel] feature proposal: ListOf

2013-10-25 Thread Romain Francois
Ushey a écrit : Hi Romain, Dirk, I'd be willing to contribute an Rcpp Gallery post and some tests if this were added to Rcpp; I think it would be quite useful. -Kevin On Wed, Oct 23, 2013 at 6:31 AM, Dirk Eddelbuettel e...@debian.org wrote: On 23 October 2013 at 14:31, Romain Francois wrote: | Le

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

2013-10-24 Thread Romain Francois
pass down an NumericVector ? The reason is that given Rcpp's design, copy semantics of NumericVector are cheap (no data copy). Which leads back to hte original question: what does Play want to do with this vector ? Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30

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

2013-10-23 Thread Romain Francois
...@debian.org | http://dirk.eddelbuettel.com -- 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] Local .h files and Rcpp attributes

2013-10-23 Thread Romain Francois
, so maybe the next someone struggles with this they may find. If someone is itching to fix this, we will gladly take patches. Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30

[Rcpp-devel] feature proposal: ListOf

2013-10-23 Thread Romain Francois
on mailing 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] max length of Rcpp::List is 20 elements?

2013-10-23 Thread Romain Francois
in this thread. FYI, in Rcpp11, create has been reimplemented to take advantage of variadic templates (from C++11), so this limitation disappears. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcpp-devel mailing list Rcpp

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

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

2013-10-19 Thread Romain Francois
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. Romain -- Romain Francois

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

2013-10-16 Thread Romain Francois
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 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https

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 milligram of Rcpp

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

2013-10-15 Thread Romain Francois
the client package needs is to use LinkingTo to pull in headers from inst/include. 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

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

2013-10-14 Thread Romain Francois
! ___ 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 -- Chief Scientist, RStudio http://had.co.nz/ -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30

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

2013-10-14 Thread Romain Francois
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 91 30 30 ___ Rcpp-devel

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

2013-10-14 Thread Romain Francois
from R's unexported Defn.h, you can get the function pointer for the internal rank. see this gist: https://gist.github.com/romainfrancois/6981372 However, if you do this in a package, there is a good chance R CMD check will moan about it because you use R_FunTab. Romain -- Romain Francois

Re: [Rcpp-devel] Rcpp11 testing

2013-10-13 Thread Romain Francois
, so I'm not too concerned about these too much yet. In any case, for things like that, please use the issue tracker: https://github.com/romainfrancois/Rcpp11/issues?state=open -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 ___ Rcpp

[Rcpp-devel] Armor, Shield and Shelter.

2013-10-11 Thread Romain Francois
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-forge.r-project.org

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 the rest

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

2013-10-11 Thread Romain Francois
I will give some concretes next week. For now, i just wanted to hint: - mean is a mammoth. Try applying mean_ : mean_ - function(.) .Internal(mean(.)) - by using x(r,_) you are allocating memory at each loop iteration, when we can use just one vector, since all rows are by definition of the

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

2013-10-10 Thread Romain Francois
. That, as best as I can tell, seems to be the way to avoid the clashes seen in Romain's first email in this thread. Some more questions re some possible future use below On 10 October 2013 at 05:15, Romain Francois wrote: | I don't particularly love macros. I much prefer templates. For example

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_name(__FILE__), __LINE__, ##__VA_ARGS__

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_RegisterCCallable | - grabs

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

2013-10-09 Thread Romain Francois
-- 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

  1   2   3   4   5   >