Re: [Rcpp-devel] Lots of lists

2012-03-13 Thread Romain Francois
an you do it differently ? Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://addictedtor.free.fr/graphiques blog:http://romainfrancois.blog.free.fr |- http://bit.ly/xbKv0R : Crawling facebook with R |- http://bit.ly/v3WB8S : ... And now fo

Re: [Rcpp-devel] Testing for existence of named components

2012-03-29 Thread Romain Francois
eturn false ; int n = Rf_length(names) ; for( int i=0; iif( !strcmp( target, CHAR(STRING_ELT(names, i)) ) ) return true ; } return false ; } It would be awesome if someone would contribute a unit test for this feature based on the inline snippet

Re: [Rcpp-devel] Testing for existence of named components

2012-03-29 Thread Romain Francois
Le 29/03/12 19:51, Patrick Burns a écrit : On 29/03/2012 18:33, Dirk Eddelbuettel wrote: On 29 March 2012 at 19:12, Romain Francois wrote: | Le 28/03/12 13:56, Ulrich Bodenhofer a écrit : |> Hi, |> |> My question is the following: is there any way of checking in whether a |> com

Re: [Rcpp-devel] Testing for existence of named components

2012-03-29 Thread Romain Francois
Le 29/03/12 20:18, Dirk Eddelbuettel a écrit : On 29 March 2012 at 18:51, Patrick Burns wrote: | On 29/03/2012 18:33, Dirk Eddelbuettel wrote: |> |> On 29 March 2012 at 19:12, Romain Francois wrote: |> | Le 28/03/12 13:56, Ulrich Bodenhofer a écrit : |> |> Hi, |> |>

Re: [Rcpp-devel] Rcpp Lists and memory corruption (resend)

2012-03-31 Thread Romain Francois
ace the line "fTouch = testFun()" with a native call to R "fTouch = list(testVar = 10)" then everything works fine. Also returning a NumericVector instead of a list also works fine -- the issue seems to appear after encapsulating the return value in a list inside of Rcp

Re: [Rcpp-devel] Rcpp Lists and memory corruption (resend)

2012-03-31 Thread Romain Francois
NumericVector instead of a list also works fine -- the issue seems to appear after encapsulating the return value in a list inside of Rcpp. I am using R 2.14.2 on Win32& Win64. Rcpp version 0.9.10. Thanks, Ilya -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph G

Re: [Rcpp-devel] Rcpp Lists and memory corruption (resend)

2012-04-07 Thread Romain Francois
. Romain Le 31/03/12 11:35, Romain Francois a écrit : Some head scratching this morning. If I have this: return Rcpp::List::create(Rcpp::Named( "testVar" ) = 10 ) ; instead of: return Rcpp::List::create(Rcpp::Named( "testVar" ) = wrap(10) ) ; everything runs smoothly. So my gu

Re: [Rcpp-devel] Unit Test Question Was: pnorm/qnorm?

2012-10-03 Thread Romain Francois
Le 13/09/12 17:56, Tim Triche, Jr. a écrit : conclusion: Romain Francois is an absolute beast of a programmer I'll put this on my grave. This was indeed crazy times where all that mattered was to get more and more and more into Rcpp. A stupid-ish question: how do ReferenceClasses map

Re: [Rcpp-devel] Odd-seeming behaviour of [[ and $

2012-10-22 Thread Romain Francois
s method definition for method value() ## [...] - - - - 8< - - - - The fact that 'x[["value"]]' finds the method only if I've first done 'x$value' seemed odd. Thanks, Ben. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http:

[Rcpp-devel] modules feature added (rev 3814)

2012-10-23 Thread Romain Francois
inter) > x C++ object <0x1006e1e20> of class 'Foo' <0x1006ccb60> > y C++ object <0x10330cc00> of class 'Foo' <0x1006ccb60> Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com blog:

Re: [Rcpp-devel] modules feature added (rev 3814)

2012-10-23 Thread Romain Francois
I continued this, and now we can also expose free functions returning pointers. For example: Foo* make_foo(){ return new Foo(3, 4) ; } See svn version of RcppBDT for a real example. Romain Le 23/10/12 15:55, Romain Francois a écrit : Hello, I've added the possibility for exposed class

Re: [Rcpp-devel] Using Rcpp without R in a main() function

2012-11-07 Thread Romain Francois
ted the function body with inline and it compiles and runs perfectly. Is there something I should specify so that the Rcpp library objects initialise correctly? Thanks a lot for any feedback, Josh -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://galler

Re: [Rcpp-devel] Matrix: column-major storage?

2012-11-07 Thread Romain Francois
;, plugin = "Rcpp", verbose = TRUE) nn <- 1 benchmark(byRow(nn), byCol(nn), columns=c("test", "replications", "elapsed", "relative", "user.self", "sys.self&qu

Re: [Rcpp-devel] Sample function(s) for inclusion in RcppArmadillo

2012-11-14 Thread Romain Francois
uld sample sugar expressions :-) Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr |- http://bit.ly/RE6sYH : OOP with Rcpp module

Re: [Rcpp-devel] Rcpp 0.10.0

2012-11-14 Thread Romain Francois
tion(s) for inclusion in RcppArmadillo (Dirk Eddelbuettel) 4. Re: Sample function(s) for inclusion in RcppArmadillo (Romain Francois) -- Message: 1 Date: Wed, 14 Nov 2012 06:42:15 -0600 From: Dirk Eddelbuettel To:

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-14 Thread Romain Francois
n to numeric on top of the price you pay for calling back into R. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr |- http://bit.ly/RE

Re: [Rcpp-devel] Rcpp 0.10.0

2012-11-14 Thread Romain Francois
ot;just" sits on top of Rcpp modules which you may have looked at in the past --- and these provide essentially mostly pass-through declarations. JJ will follow-up in a bit with more nitty-gritty. Cheers, Dirk -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery:

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-14 Thread Romain Francois
0.015 Romain Le 15/11/12 00:08, Søren Højsgaard a écrit : Thanks! What I need to do is this match(c("b","k"), letters) [1] 2 11 Regards Søren -Original Message- From: rcpp-devel-boun...@lists.r-forge.r-project.org [mailto:rcpp-devel-boun...@lists.r-forge.

Re: [Rcpp-devel] Rcpp 0.10.0

2012-11-14 Thread Romain Francois
ome dummy classes that prints on copy constructor to see how many times it is used, etc ... -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blo

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-14 Thread Romain Francois
this goes into the next version of Rcpp? That would be nice. Regards Søren -Original Message- From: Romain Francois [mailto:rom...@r-enthusiasts.com] Sent: 15. november 2012 00:50 To: Søren Højsgaard Cc: rcpp-devel@lists.r-forge.r-project.org Subject: Re: [Rcpp-devel] Rcpp "versi

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-15 Thread Romain Francois
ion gets better the second time. I guess R keeps its hash table somewhere. Romain Le 15/11/12 08:36, Søren Højsgaard a écrit : Thanks a lot; that seems elegant. Could one imagine that this goes into the next version of Rcpp? That would be nice. Regards Søren -Original Message- From: R

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Romain Francois
) [1] Inf > sum1(x) [1] Inf > sum2(x) [1] Inf > sum2a(x) [1] Inf > sum3(x) [1] Inf > sum4(x) [1] Inf > x <- c(1, 2, NA ) > sum(x) [1] NA > sum1(x) [1] NA > sum2(x) [1] NA > sum2a(x) [1] NA > sum3(x) [1] NA > sum4(x) [1] NA So, not sure why we should pa

Re: [Rcpp-devel] Loops, iterators and accumulate

2012-11-15 Thread Romain Francois
Le 15/11/12 15:14, Hadley Wickham a écrit : On Thu, Nov 15, 2012 at 8:11 AM, Romain Francois wrote: I'm not getting the same results, so I might not make the same conclusions: Unit: microseconds exprmin lq median uqmax 1 sum(x) 16.072 16.161 16.2090 16.3110 2

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-15 Thread Romain Francois
^^. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr |- http://bit.ly/RE6sYH : OOP with Rcpp modules `- http://bit.ly/Thw7IK : Rcpp modules more

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-15 Thread Romain Francois
ov 15, 2012 at 3:24 PM, Romain Francois mailto:rom...@r-enthusiasts.com>> wrote: Le 15/11/12 14:52, Hadley Wickham a écrit : R utilisateur système écoulé 0.338 0.024 0.362 R (second time) utilisateur

[Rcpp-devel] Rcpp version of %in%

2012-11-15 Thread Romain Francois
on't care where the data is on the table, we just want to know if it is there. Might be interesting at some point to check alternatives to the standard hasing functions... e.g. play with sparsehash: http://code.google.com/p/sparsehash/ Romain -- Romain Francois Professional R Enthusiast

Re: [Rcpp-devel] Rcpp version of %in%

2012-11-15 Thread Romain Francois
Le 15/11/12 17:52, Romain Francois a écrit : Hello, I've commited an Rcpp version of %in%. For example: require(Rcpp) require(microbenchmark) sourceCpp( code = ' #include using namespace Rcpp ; // [[Rcpp::export]] LogicalVector in_( CharacterVector x, CharacterVector table){

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-15 Thread Romain Francois
e" in c++. Best regards Søren Hmmm - see http://cran.r-project.org/web/packages/fastmatch/index.html Hadley PS. Would you be interested in a set of R functions that from a quick skim of the R sources that I think could be much much faster if implemented in Rcpp? -- RStud

Re: [Rcpp-devel] Missing values

2012-11-16 Thread Romain Francois
x.begin(), out_it = out.begin(); x_it != x.end(); x_it++, out_it++) { *out_it = ISNA(*x_it); } return(out); } ') is_na2(c(NA, 5.4, 3.2, NA)) Rcpp provides a helper function called `is_na` that works similarly to `is_na2` above, producing a logical

Re: [Rcpp-devel] Missing values

2012-11-16 Thread Romain Francois
Le 16/11/12 14:00, Hadley Wickham a écrit : On Fri, Nov 16, 2012 at 2:25 AM, Romain Francois wrote: Thanks for exploring these issue. This looks very useful. I get: str( first_log(NA) ) logi TRUE str( first_int(NA_integer_) ) int NA str( first_num(NA_real_) ) num NA str

Re: [Rcpp-devel] Debugging Rcpp code

2012-11-16 Thread Romain Francois
groups.begin(); NumericVector::iterator o_it = out.begin(); for(; g_it != groups.end(); ++g_it, ++o_it) { *o_it = as(fun(wrap(*g_it))); } I'd appreciate any hints as to how to solve this particular problem, as well as any general debugging strategies. Thanks! Hadle

Re: [Rcpp-devel] setdiff

2012-11-16 Thread Romain Francois
ugh at first I also learned many tricks from Meyers' Effective STL. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr

Re: [Rcpp-devel] "const" not allowed for Matrix arguments?

2012-11-16 Thread Romain Francois
2; return dd; } // [[Rcpp::export]] int f3(const Rcpp::IntegerMatrix m1) { int dd = m1(0, 0) * 2; return dd; } -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:

Re: [Rcpp-devel] Rcpp "version" of R's match function

2012-11-16 Thread Romain Francois
ng function performs better. ... Not giving up -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr |- http://bit.ly/RE6sYH : OOP wi

Re: [Rcpp-devel] Fwd: latest incompatible changes for package developers?

2012-11-16 Thread Romain Francois
peed up this recovery and be compatible with the new version? How much change should I expect? Thanks. All the best, baptiste * https://github.com/baptiste/cda http://cran.r-project.org/web/packages/cda/index.html -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Gra

Re: [Rcpp-devel] Fwd: latest incompatible changes for package developers?

2012-11-16 Thread Romain Francois
ld really get into a proper testing framework. In the meantime, I'll be writing a few tests with Hadley's testthat. All the best, baptiste I'm looking at this issue now. Thanks for providing the example with euler. This is helpful. On 17 November 2012 11:20, Romain Francois mail

Re: [Rcpp-devel] Feedining an IntegerVector into Rcout?

2012-11-16 Thread Romain Francois
list(c("a","b"),c("b","c"), c("a","c","e"), c("a","c","q")), letters[1:10]) 0xca858e0 0xca85cd0 0xd715d80 0xd715db8 [[1]] [1] 1 2 [[2]] [1] 2 3 [[3]] [1] 1 3 5 [[4]] [

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread Romain Francois
][,3] [1,] -0.4377827 -0.8982855 0.03780919 [2,] -0.3894132 0.1515423 -0.90851102 [3,] 0.8103726 -0.4124538 -0.41614684 [1] 3 3 [1] "matrix" [,1] [,2][,3] [1,] -0.4377827 -0.8982855 0.03780919 [2,] -0.3894132 0.1515423 -0.90851102 [3,] 0.8103726 -0.41

Re: [Rcpp-devel] broken package after udpate

2012-11-16 Thread Romain Francois
On 17 November 2012 12:44, Romain Francois mailto:rom...@r-enthusiasts.com>> wrote: This is about one of C++ most annoying things. order of includes. To make it short, the function that is responsible for making an R object out of the returned arma::mat is module_wrap, wh

Re: [Rcpp-devel] Struggling with Rcpp sugar

2012-11-17 Thread Romain Francois
Both pdist4 and pdist5 are undeterminate behaviour. I would prefer to keep it that way and document it that vector should have the same size, ... rather than introduce the extra cost of recyling. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http

Re: [Rcpp-devel] Working with strings

2012-11-17 Thread Romain Francois
; out[0] = NA_STRING ; return out ; }') Not as convenient. :-/ -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr |- htt

Re: [Rcpp-devel] Struggling with Rcpp sugar

2012-11-17 Thread Romain Francois
ys) { return pow((ys - x), 2); } ') all.equal(pdist1(0.5, ys), pdist5(0.5, ys)) # Where are the missing values coming from?? -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm S

Re: [Rcpp-devel] Struggling with Rcpp sugar

2012-11-17 Thread Romain Francois
341.235 3 pdist3(0.5, ys) 262.306 262.7620 262.9740 263.8560 565.902 4 pdist4(0.5, ys) 264.561 264.9355 265.1850 266.8125 858.453 5 pdist5(0.5, ys) 15.700 16.1570 16.4030 17.2045 318.126 6 pdist6(0.5, ys) 31.264 31.5755 31.7225 32.3770 332.139 Romain Le 17/11/12 17:40, Romain Francois a écrit

Re: [Rcpp-devel] Struggling with Rcpp sugar

2012-11-18 Thread Romain Francois
be nice to have some sort of declarative syntax like: recycle(x, y, z); Hadley In a way, we can already use sugar rep_len. rep_len( x, 30 ) will recycle x into a vector of length 30, lazily. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-e

Re: [Rcpp-devel] Working with strings

2012-11-18 Thread Romain Francois
Le 18/11/12 15:35, Hadley Wickham a écrit : On Sat, Nov 17, 2012 at 9:23 AM, Romain Francois wrote: Le 17/11/12 15:22, Hadley Wickham a écrit : Hi all, Am I doing something wrong with the functions below, or has this behaviour not yet been implemented in Rcpp? cppFunction(

Re: [Rcpp-devel] Rcpp RMpfr mpreal to mpfr wrapping

2012-11-18 Thread Romain Francois
includes=headers, body=sources, plugin="RcppMpfr", verbose=FALSE) Sample Function Benchmark timings <- benchmark( factorial( mpfr(93,255) ), mpreal_factorial(93,255), Rmpfr::factorialMpfr

Re: [Rcpp-devel] Clang 3.0 and 3.3 errors on sugar/set.h

2012-11-19 Thread Romain Francois
The thing about #elseif has been fixed on the development version a few days ago. Can you try again with the scn version of rcpp ? Also, if you use c++11 features, you are on your own. We will happily do c++11 code when we get some sort of green light from cran, which might take years. Romain

Re: [Rcpp-devel] Formatting Fixed - Clang 3.0 and 3.3 errors on sugar/set.h

2012-11-19 Thread Romain Francois
Yes. That´s it, and this is fixed in the current devel version of Rcpp. Romain Envoyé de mon iPhone Le 19 nov. 2012 à 19:40, Chris Jefferson a écrit : > On 19/11/12 17:33, Thell Fowler wrote: >> >> /home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:28:2: error: >> invalid preprocessing dir

Re: [Rcpp-devel] Dispatching based on SEXPTYPE

2012-11-21 Thread Romain Francois
ividual unique1 methods, but I'd like to keep it simple for now). Thanks! Hadley -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free

Re: [Rcpp-devel] R vectorisation vs. C++ vectorisation

2012-11-21 Thread Romain Francois
pmax( b, pmin( a, x ) ) I'm thinking of naming it pminmax. Any better idea ? Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr

Re: [Rcpp-devel] R vectorisation vs. C++ vectorisation

2012-11-21 Thread Romain Francois
with the correct signature, dealing with individual elements. Similar idea. Hence I would prefer to invoke the 80/20 rule as I think we have better targets to chase than to narrow that gap. But that's just my $0.02... If you can't sleep til both version have 20-some micros

Re: [Rcpp-devel] R vectorisation vs. C++ vectorisation

2012-11-21 Thread Romain Francois
for me :-) How about clip(): p = clip(p, 0.0, 1.0); I like "clip". This is such a common operation that I'm surprised R doesn't already have a function like this! Darren -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http:/

Re: [Rcpp-devel] R vectorisation vs. C++ vectorisation

2012-11-21 Thread Romain Francois
/12 14:22, Alexandre Bujard a écrit : How about clip(): p = clip(p, 0.0, 1.0); Great idea!!! On Wed, Nov 21, 2012 at 2:00 PM, Romain Francois mailto:rom...@r-enthusiasts.com>> wrote: Le 21/11/12 13:22, Darren Cook a écrit : I wrote: P.S. I don'

Re: [Rcpp-devel] R vectorisation vs. C++ vectorisation

2012-11-21 Thread Romain Francois
ives and opportunities. This resulted in some improvements in Rcpp about the assuignment operator in Vector and pmin and pmax which just needed a fresh look. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `-

Re: [Rcpp-devel] Dispatching based on SEXPTYPE

2012-11-21 Thread Romain Francois
speed, apart from the logical case, which I find surprising given that it should have the least copying to do. Hadley Then I was guessing wrong and the compiler performs optimization. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusias

Re: [Rcpp-devel] Inline, templates, and easy debugging

2012-11-22 Thread Romain Francois
ExposedFunction( DataFrame df ){ int n = df.size() ; for( int i=0; i> df <- data.frame( a = integer(10), b = character(10), stringsAsFactors = FALSE ) > ExposedFunction( df ) dealing with an object of type: Rcpp::Vector<13> dealing with an object of type: Rcpp::Vector<16&

Re: [Rcpp-devel] Dispatching based on SEXPTYPE

2012-11-22 Thread Romain Francois
SET set(vector.begin(), vector.end()); return Vector out( set.begin(), set.end() ) ; } But the range constructor for Vector does not do what I want. I'm looking into it. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-

Re: [Rcpp-devel] Dispatching based on SEXPTYPE

2012-11-22 Thread Romain Francois
CPLXSXP and VECSXP . I have this as RcppScript now on my ~/bin: #!/usr/bin/Rscript require(Rcpp, quietly = TRUE) args <- commandArgs(TRUE) file <- tail( args, 1 ) sourceCpp( file ) So I run this file as $ RcppScript /tmp/unique2.cpp [1] 2.4 1.0 5.3 [1] 1 2 [1] "b" "a&qu

Re: [Rcpp-devel] Dispatching based on SEXPTYPE

2012-11-22 Thread Romain Francois
. There is no other way I know about. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr |- http://bit.ly/RE6sYH : OOP with

Re: [Rcpp-devel] Rcpp 0.10.1 and RcppEigen

2012-11-29 Thread Romain Francois
se Linux version 4. This is for our cluster, so it is not easy for me to update. Kasper ___ 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 Profe

Re: [Rcpp-devel] A beginners guide to Rcpp

2012-11-29 Thread Romain Francois
his. I'll look this over, Hadley, once things settle down. Thanks for your efforts on this! You're welcome, and any feedback will be greatly appreciated. Hadley -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com

Re: [Rcpp-devel] Rcpp::stop crashes RGui and RStudio under Windows

2012-11-30 Thread Romain Francois
sting the normal case } END_RCPP } ? Not so terrible -- especially if you have some Rcpp snippets set up in your editor of choice, no? -steve We are discussing ways around this issue. I think we can do something that would work on windows and not require us writing boiler plate stuff. Romain -- Ro

Re: [Rcpp-devel] Patch for using Rcpp with proper check of TR1/C++11 headers

2012-12-03 Thread Romain Francois
StringCompare { | public: | -inline bool operator()( SEXP x, SEXP y){ | +inline bool operator()( SEXP x, SEXP y) const { | return strcmp( char_nocheck(x), char_nocheck(y) ) < 0 ; | } | } ; -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: h

Re: [Rcpp-devel] Rcpp: Distinguishing between input types to function call

2012-12-03 Thread Romain Francois
r (ii = 0; ii < ncX; ii++) { indegree[ii] = 0; flag[ii] = 0; ans[ii] = 0; } for (jj = 0; jj < ncX; jj++) for (ii = 0; ii < ncX; ii++) indegree[jj] = indegree[jj] + X.coeff(ii,jj); /* Rcout<<"indegree: ";for (ii=0;ii -- Romain Franco

Re: [Rcpp-devel] Rcpp: Distinguishing between input types to function call

2012-12-04 Thread Romain Francois
mbiguate it at runtime and then let the template do its job. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com `- http://bit.ly/SweN1Z : SuperStorm Sandy blog:http://romainfrancois.blog.free.fr |- http://bit.l

Re: [Rcpp-devel] How to increase the coding efficiency

2012-12-04 Thread Romain Francois
ncy of the coding? Thanks. Best wishes! Honglang Wang Office C402 Wells Hall Department of Statistics and Probability Michigan State University 1579 I Spartan Village, East Lansing, MI 48823 wangh...@msu.edu <mailto:wangh...@msu.edu> -- Romain Francois Professional R Enthusiast +33(0)

Re: [Rcpp-devel] How to increase the coding efficiency

2012-12-04 Thread Romain Francois
ility Michigan State University 1579 I Spartan Village, East Lansing, MI 48823 wangh...@msu.edu <mailto:wangh...@msu.edu> On Tue, Dec 4, 2012 at 2:19 PM, Romain Francois mailto:rom...@r-enthusiasts.com>> wrote: You are calling back to R using Function. This is expensive. What is

Re: [Rcpp-devel] "No matching function for call to as(double&)" error at compile time

2012-12-06 Thread Romain Francois
’ which should give you enough of a clue. The argument for as is a SEXP : template T as( SEXP m_sexp) and NumericVector::operator[](int) gives you a reference to a double Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enth

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
Matrix) i <- c(1,3:8); j <- c(2,9,6:10); x <- 7 * (1:7) ( A <- sparseMatrix(i, j, x = x) ) convert(A) ***/ I don't think there is a better way to fill multiple values ina SpMat, maybe Conrad has insights. Romain -- Romain Francois Professional R Enthusiast +33(0) 6

[Rcpp-devel] Rcpp internal benchmark tool

2012-12-08 Thread Romain Francois
r.h?view=markup&root=rcpp and the implementation: https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/src/Timer.cpp?view=markup&root=rcpp Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com blog:h

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29 This layout is used by a majority of external solvers. It would be far more efficient to take this layout into account when copying matrices, instead of blindly (and slowly) copying element by element. On Sunday, December 9, 2012, Romain Francois

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
Ah. One thing I could do is leverage this: #ifdef ARMA_EXTRA_SPMAT_PROTO #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPMAT_PROTO) #endif Not sure how yet. Le 08/12/12 19:17, Romain Francois a écrit : That looks very similar, if not identical to what dgCMatrix uses. Can you direct me to a

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-08 Thread Romain Francois
oable. Romain On Sunday, December 9, 2012, Romain Francois mailto:rom...@r-enthusiasts.com>> wrote: > Le 08/12/12 09:45, Søren Højsgaard a écrit : >> >> Dear all, >> >> I want to use a matrix (of type "dgCMatrix" from th

Re: [Rcpp-devel] Sparse matrices with RcppArmadillo

2012-12-09 Thread Romain Francois
, Dec 9, 2012 at 5:55 AM, Romain Francois wrote: Yes. Conrad left a back door open so that we can add things **inside** the SpMat template, similar to what we have done in dense matrix classes. Going from there I was looking at the copy constructor of a SpMat, which eventually is a call to init: /

Re: [Rcpp-devel] RcppArmadillo: passing matrix columns by reference

2012-12-10 Thread Romain Francois
//will not work return List::create(Named("X") = wrap(X), Named("of1") = outf1, Named("of2") = outf2); } -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http:/

Re: [Rcpp-devel] RcppArmadillo: passing matrix columns by reference

2012-12-10 Thread Romain Francois
Le 10/12/12 17:06, Romain Francois a écrit : the .col method gives you a subview_col : arma_inline subview_col col(const uword col_num); arma_inline const subview_col col(const uword col_num) const; not an umat. The name of the class implies that it is a "view" class, s

Re: [Rcpp-devel] For a Matrix A, is A(i, j) or A[i, j] preferred as an accessor for an element

2012-12-10 Thread Romain Francois
Le 10/12/12 17:45, Douglas Bates a écrit : On Mon, Dec 10, 2012 at 10:38 AM, Romain Francois mailto:rom...@r-enthusiasts.com>> wrote: Le 10/12/12 17:29, Douglas Bates a écrit : or does it matter? A[i,j] is wrong, not valid C or C++ code. so there is only one choice.

Re: [Rcpp-devel] Joining each row of CharacterMatrix to return a CharacterVector?

2012-12-10 Thread Romain Francois
r entries of a row of the CharacterMatrix X into a single string that will then comprise an element of the returned CharacterVector Y? Many thanks, Pete Peter Hickey, PhD Student/Research Assistant, Bioinformatics Division, Walter and Eliza Hall Institute of Medica

Re: [Rcpp-devel] Joining each row of CharacterMatrix to return a CharacterVector?

2012-12-11 Thread Romain Francois
ent of the returned CharacterVector Y? Many thanks, Pete Peter Hickey, PhD Student/Research Assistant, Bioinformatics Division, Walter and Eliza Hall Institute of Medical Research, 1G Royal Parade, Parkville, Vic 3052, Australia. Ph: +613 9345 2324 hic...@wehi

[Rcpp-devel] binding, combining vectors

2012-12-13 Thread Romain Francois
;u" "v" "w" "x" "y" "z" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" [39] "m" "n" "o" &q

Re: [Rcpp-devel] iak problem -- dyn.load unable to load shared object

2012-12-13 Thread Romain Francois
Dr. Glenn Lawyer +352 661 967 244 Max-Planck-Institut für Informatik Computational Biology and Applied Algorithmics Campus E1 4 66123 Saarbrücken, Germany http://bioinf.mpi-inf.mpg.de/~lawyer ___ Rcpp-devel maili

Re: [Rcpp-devel] binding, combining vectors

2012-12-13 Thread Romain Francois
Le 13/12/12 17:29, Dirk Eddelbuettel a écrit : On 13 December 2012 at 10:01, Romain Francois wrote: | Hello, | | I'd like to add a functionality to "bind" vectors of the same type (well | sugar expressions really, but let's say it is vectors for the sake of | this email). |

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Romain Francois
an State University 1579 I Spartan Village, East Lansing, MI 48823 wangh...@msu.edu <mailto:wangh...@msu.edu> [1] Links: -- [1] mailto:wangh...@msu.edu <mailto:wangh...@msu.edu> -- Romain Francois Professional R Enthusiast +33(0) 6

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-14 Thread Romain Francois
List::create(Named("betahat") = betahat00); > > Best wishes! > > Honglang Wang > > Office C402 Wells Hall > Department of Statistics and Probability > Michigan State University > 1579 I Spartan Village, East Lansing, MI 48823 > wangh...@msu.edu > > &

Re: [Rcpp-devel] Wrapping a C struct in C++ for constructor/destructor

2012-12-14 Thread Romain Francois
I would create a class that contains a pointer to the c struct. This obviously leaves the problem of freeing the memory, i.e does the c++ object own the pointer. Maybe a strategy using some reference counting smart pointer. In RcppEigen we have not resolved this, we simply exposed a free met

Re: [Rcpp-devel] Build of Rcpp from svn failure

2012-12-16 Thread Romain Francois
Thanks for the notice, will fix when i get a chance if nobody else does it first. I simplified this file yesterday to trim some old unused code, so i'll take the blame... The fix should just be to add #include On top of the file somewhere. Romain Le 16 déc. 2012 à 17:53, Thell Fowler

Re: [Rcpp-devel] Build of Rcpp from svn failure

2012-12-16 Thread Romain Francois
Sure. Something like that, typeinfo is pretty orthogonal to features of the other includes, so no issue of header order. While you're there, does R CMD check Rcpp work fine ? Romain Le 16 déc. 2012 à 18:04, Thell Fowler a écrit : > diff --git a/pkg/Rcpp/src/exceptions.cpp b/pkg/Rcpp/src/ex

Re: [Rcpp-devel] Problems returning fload

2012-12-19 Thread Romain Francois
pp-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 R Graph Gallery: http://gallery.r-enthusiasts.com blog:http://romainfrancois.b

Re: [Rcpp-devel] #include gretl libraries in Rcpp

2012-12-19 Thread Romain Francois
uidance would be really appreciated! many thanks, jean ___ 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] #include gretl libraries in Rcpp

2012-12-19 Thread Romain Francois
::sugar::All::All(const Rcpp::VectorBase<10, false, LHS_T>&)’: /usr/lib/R/library/Rcpp/include/Rcpp/sugar/functions/all.h:64: error: expected ‘(’ before ‘,’ token On Thursday, December 20, 2012 at 12:48 AM, "Romain Francois" wrote: The extern "C" looks

Re: [Rcpp-devel] Using pointers with Numeric Vectors

2012-12-21 Thread Romain Francois
100 Rcpp.var = cxxfunction(signature(input="numeric"), plugin="Rcpp", body=" NumericVector v = input; int n = v.size(); double v_mean = get_sum(v,n)/n; double v_var = get_var(v,v_mean,n); return wrap(v_var);

Re: [Rcpp-devel] Rcpp and C++ mangling

2012-12-21 Thread Romain Francois
Are you linking against the gretl library ? Le 21 déc. 2012 à 12:12, jea...@hushmail.com a écrit : > hi, > > a quick question regarding a Rcpp function I wrote using an external library > (gretl) : > > with the help of a makefile (adapted from the convolution Rcpp example), the > code compi

Re: [Rcpp-devel] Most efficient way to apply function over rows of a matrix with Rcpp?

2013-01-30 Thread Romain Francois
0 Maybe there is something we can do at our end to improve this by making a more efficient iterator over a matrix row. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com blog:http://romainfrancois.bl

Re: [Rcpp-devel] package with module not compiling on Mac

2013-01-31 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 -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-en

Re: [Rcpp-devel] Performance question about DataFrame

2013-01-31 Thread Romain Francois
y 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 R Graph Gallery: http://gallery.r-enthusiasts.com blog:http://romainfrancois.blog.free.fr |- http://bit.ly/RE6sYH :

Re: [Rcpp-devel] package with module not compiling on Mac

2013-01-31 Thread Romain Francois
just a few things that I found odd while looking at your code. (It took me more time to write this email than finding these odd :-) ). Romain I will try to make it by adapting the two functions and their use ! Robin - Mail original - De: "Romain Francois" À: rcpp-devel

Re: [Rcpp-devel] Rcpp and boost on Windows 7

2013-02-03 Thread Romain Francois
n sourceCpp("testBoost.cpp") : Error 1 occurred building shared library. Regards, André Hello, You should have a look at the BH package, with which all you have to do (I think) is to have this in your DESCRIPTION: LinkingTo: BH, Rcpp And you're good to go. Romain -- Romain

Re: [Rcpp-devel] "expecting a string" and not finding it in a CharacterVector

2013-02-07 Thread Romain Francois
Thanks. I will fix it. Romain Le 8 févr. 2013 à 05:28, Davor Cubranic a écrit : > On 13-02-07 07:24 PM, Davor Cubranic wrote: >> The version assigning an element of a const CharacterVector to a const >> std::string (named "bar" below) compiles and works fine in Rcpp 0.9.14, >> so the problem w

Re: [Rcpp-devel] A though on Rcpp::wrap

2013-02-08 Thread Romain Francois
Thank you for this detailed email, i will study it carefully. Romain Le 8 févr. 2013 à 13:16, Yan Zhou a écrit : > This morning I was frustrated by a compilation error, below is a scratch of > the problem > > // MyClass1.h > template > class MyClass {/*...*/}; > > #include > namespace R

Re: [Rcpp-devel] "expecting a string" and not finding it in a CharacterVector

2013-02-10 Thread Romain Francois
Right. I see what you mean. If it does bot disturbe anything else, i should be able to bring it back. Romain Le 10 févr. 2013 à 04:54, Davor Cubranic a écrit : > On 13-02-09 05:06 AM, Dirk Eddelbuettel wrote: >> >> On 8 February 2013 at 20:58, Davor Cubranic wrote: >>> That fixed just the

  1   2   3   4   5   6   7   8   >