Re: [Rcpp-devel] RcppParallel on Solaris

2015-04-13 Thread Romain François
> Le 13 avr. 2015 à 14:03, JJ Allaire a écrit : > > That's excellent I just updated the branch to reflect this change > and also successfully ran the tests on the Solaris config that you > provided me access to. > > I'll have to take a closer look at the warnings. One other issue that > nee

Re: [Rcpp-devel] RInside vs Statconndcom

2015-04-04 Thread Romain François
RInside is not really about performance. it’s just a way to easily embed R in a C++ application. > Le 4 avr. 2015 à 19:54, Jodi Jhouranda Siregar <11.6...@stis.ac.id> a écrit : > > I'm on my project developing user interface for r. I dicided to use rinside. > And i want to know which is better

Re: [Rcpp-devel] Problem with IntegerVector::value_type in recent Rcpp

2015-03-31 Thread Romain François
gt; As a follow-up, is there a reason why value_type is defined in terms of a > reference? In the mean time, I'll use remove_reference. > > -Kevin > > >> On Mar 31, 2015, at 1:04 AM, Romain François >> wrote: >> >> Hi, >> >> Th

Re: [Rcpp-devel] Problem with IntegerVector::value_type in recent Rcpp

2015-03-31 Thread Romain François
Hi, That’s because VTYPE::value_type is traits::r_vector_proxy::type, i.e. template struct r_vector_proxy{ typedef typename storage_type::type& type ; } ; so VTYPE::value_type is int& You can either use stored_type, i.e. std::for_each( v.begin(), v.end(),[]( const VTYPE::s

Re: [Rcpp-devel] Accessing list of list members to permute them

2015-03-30 Thread Romain François
Hi, Perhaps you can use ListOf instead of List, as output[i] does not know it is a matrix, so the operator()(int, int) don’t make sense. You’d need (untested, ont sure you can nest layers of ListOf) ListOf< NumericMatrix > x ListOf< ListOf > output ; Otherwise, perhaps something like the m

Re: [Rcpp-devel] Rcpp Parallel and Rcpp Armadillo

2014-12-10 Thread Romain François
Some pointers. When you use an arma::mat passed by value in an Rcpp::export, this means copying all of the data of the underlying R object into armadillo. I’d suggest you use a reference to const to avoid that, i.e. mat contrib1(const mat& X1) { … } Then in pQnorm, you do: NumericMatrix x_

Re: [Rcpp-devel] Rcpp and ExternalPtr

2014-12-05 Thread Romain François
You are looking for XPtr. https://github.com/RcppCore/Rcpp/blob/master/inst/include/Rcpp/XPtr.h It is a template class whose first parameter is the class of the raw pointer you are dealing with, let’s call it T. You can create an external pointer using something like : XPtr xp( new T(...) )

Re: [Rcpp-devel] Returning an arma vec

2014-12-04 Thread Romain François
Something like this: template inline wrap( const arma::subview_col& x ){ return wrap( arma::Mat( x ) ) ; } (untested) This would still wrap it as a matrix though as this is what subview_col conceptually gives. The only downside is that this is somewhat inefficient as it would have to

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

2014-11-30 Thread Romain François
And now sent a pull request. Not sure this will be merged in with the new commandment that « Thou shalt not break abi ». See: https://github.com/RcppCore/Rcpp/pull/211 Romain > Le 29 nov. 2014 à 13:52, Romain François a écrit : > > Promoted this to an issue on github. > https:

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

2014-11-29 Thread Romain François
Promoted this to an issue on github. https://github.com/RcppCore/Rcpp/issues/209 Should not be very hard to fix, but this is indeed a bug. The code should not compile if Rcpp respected const correctness. > Le 26 nov. 2014 à 14:20, Martyn Plummer a écrit : > > This is related to David Shih's t

Re: [Rcpp-devel] Bug in loadRcppClass/loadModule?

2014-11-19 Thread Romain François
sourceCpp knows how to deal with modules, i.e.: inc <- ' #include using namespace Rcpp; double norm( double x, double y ) { return sqrt( x*x + y*y ); } RCPP_MODULE(mod) { function( "norm", &norm ); }' sourceCpp( code = inc ) giving: > norm( 3, 3 ) [1] 4.242641 Romain > Le 19 nov. 2

Re: [Rcpp-devel] tracking volatile bug

2014-11-18 Thread Romain François
> Le 18 nov. 2014 à 14:42, Serguei Sokol a écrit : > > Hi everybody, > > I am facing a volatile bug which appears and disappears in > identical calls on identical data. > > My RcppArmadilla code is expm_cpp() (it is obtained by rex2arma tool > which I have presented before, cf. attached file).

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

2014-08-20 Thread Romain François
This would be typical gc problems. Could be anywhere. Even if you run it through gdb, the problem will incubate for some time before showing symptoms. We’ve been lucky sometimes to fix some of these by accident, but it is otherwise pretty hard. Romain Le 20 août 2014 à 19:38, Gregor Kastner

Re: [Rcpp-devel] Template and non-template arguments in RCPP_RETURN_VECTOR

2014-08-20 Thread Romain François
Hi, I guess RCPP_RETURN_VECTOR could be easily extended to support variadic number of arguments, using either variadic templates or variadic macros. https://github.com/RcppCore/Rcpp/blob/3ef9e662d89ebcfe71734675071568302bf10104/inst/include/Rcpp/macros/dispatch.h#L44 RCPP_RETURN_VECTOR is not

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

2014-07-29 Thread Romain François
Sent a PR. Everything was pretty well explained in the original email. Le 29 juil. 2014 à 13:51, Dirk Eddelbuettel a écrit : > > On 29 July 2014 at 12:17, Christian Authmann wrote: > | Sorry, due to a restrictive firewall on my dev computer, I cannot access > | github from it. A mail will hav

Re: [Rcpp-devel] Using spatstat in Rcpp

2014-06-11 Thread Romain François
Hello, You seem to be confusing R namespaces and C++ namespaces and assuming you can call an R function as if it belonged to a C++ namespace. R functions and c++ functions are different things. You can do something like: // get the spatstat environment Environment spatstat( "package:spatsta

Re: [Rcpp-devel] type information about elements in Rcpp::List

2014-06-09 Thread Romain François
Le 9 juin 2014 à 21:40, Chaomei Lo a écrit : > > I have a R list something like this - > > op=list(a=200, b="test", c=4.5) > when I pass it as an argument to Rcp Export function which the code looks > like this in below. > > > int n = xlist.length(

Re: [Rcpp-devel] Speed up of the data.frame creation in DataFrame.h

2014-06-07 Thread Romain François
to the plain R code. > I am not sure at this point what solution would be the best, but having fast > methods in Rcpp would be really great. > Should I wait then before submitting the pull request? > Dmitry > > On Jun 7, 2014, at 7:21 AM, Romain François wrote: > >> >

Re: [Rcpp-devel] Speed up of the data.frame creation in DataFrame.h

2014-06-07 Thread Romain François
Le 7 juin 2014 à 03:27, Dmitry Nesterov a écrit : > Hello, > Here I report the slowness in creation of Rcpp DataFrame objects and proposed > change to speed it up. > For system information, here is output from sessionInfo(): > R version 3.1.0 (2014-04-10) > Platform: x86_64-apple-darwin13.1.0 (

Re: [Rcpp-devel] table, rev and missing names

2014-06-06 Thread Romain François
Hello, You pretty much have to do this manually. rev is part of Rcpp sugar. Defined here: https://github.com/RcppCore/Rcpp/blob/master/inst/include/Rcpp/sugar/functions/rev.h It does not preserve names. That’s by design. It would have been very difficult to do it automatically, i.e. what happe

Re: [Rcpp-devel] Rcpp release candidate

2014-06-05 Thread Romain François
Watch out for this part: Le 5 juin 2014 à 15:05, Gabor Grothendieck a écrit : > installing to C:/Users/Gabor/Documents/R/win-library/3.1/Rcpp/libs/x64 > Warning in file.copy(files, dest, overwrite = TRUE) : > problem copying .\Rcpp.dll to > C:\Users\Gabor\Documents\R\win-library\3.1\Rcpp\libs\

Re: [Rcpp-devel] Converting std::cout to Rcpp::Rcout automatically

2014-05-23 Thread Romain François
Hi, I used to redirect std::cout to Rcpp::Rcout back when I still had Rcout in Rcpp11. e.g. https://github.com/Rcpp11/Rcpp11/blob/22cc410ea87a2668e547acf6510d07ca812dfca8/src/Rcpp11_init.cpp Which was basically leveraging std::cout.rdbuf. A variant of http://stackoverflow.com/questions/10150

Re: [Rcpp-devel] Not able to convert from Rcpp::NumericVector to Teuchos::ArrayRCP

2014-05-22 Thread Romain François
Hello, From what I understand of ArrayRCP, having read the documentation for a few minutes. (http://trilinos.sandia.gov/packages/docs/r9.0/packages/teuchos/doc/html/classTeuchos_1_1ArrayRCP.html) This looks like a vector and therefore it is likely that the default Exporter will not be useful a

Re: [Rcpp-devel] bigmatrix and segmentation fault due to 'memory not mapped'

2014-05-15 Thread Romain François
Le 15 mai 2014 à 09:03, Stefano Calza a écrit : > Hi everybody, > > I am trying to use big.matrix from Rcpp basically to write some (integer) > data to a matrix. > > I keep getting segmentation fault due to 'memory not mapped'. > Debugging with gdb I found out that the critical point is > >

Re: [Rcpp-devel] [OT] Asking for a quick OS X favour

2014-05-11 Thread Romain François
Works fine for me after installing hiredis from brew. https://gist.github.com/romainfrancois/e70e6c49fdda9172b644 Le 11 mai 2014 à 19:05, Dirk Eddelbuettel a écrit : > > On 11 May 2014 at 09:41, Hao Ye wrote: > | So why does the directory /usr/include/hiredis get omitted on OS X? > |

Re: [Rcpp-devel] Rcpp11 3.1.0 is on CRAN

2014-04-17 Thread Romain François
Le 17 avr. 2014 à 09:42, Hao Ye a écrit : > Hi Romain, > > Thanks for the explanation -- I was curious about the difference between Rcpp > and Rcpp11, as well. > > What might help you deciding is that in Rcpp11, we did not retain some > features such as modules and date/time related classes

Re: [Rcpp-devel] Rcpp11 3.1.0 is on CRAN

2014-04-17 Thread Romain François
Hello, (may contains traces of personal opinions) My motivation for starting Rcpp11 were: - Assuming C++11, which is nicer to use and teach. Rcpp still wants to be compatible with older standard, which essentially means that even if I write something new using C++11, I still have to figure ou

Re: [Rcpp-devel] Error in Module

2014-04-08 Thread Romain François
Hello, Just sourceCpp the .cpp file and use the functions verbatim: > sourceCpp( "/tmp/mod.cpp" ) > bar(2L) [1] 4 If you really want to use the module as an object, you have to pick it up from the right spot: > yada <- Module("yada", where = tail(getLoadedDLLs(), 1)[[1]] ) > yada$hello() [

Re: [Rcpp-devel] Distribution of Rcpp codebase

2014-04-08 Thread Romain François
Le 8 avr. 2014 à 11:47, Rainer M Krug a écrit : > Romain François writes: > >> Le 8 avr. 2014 à 10:51, Rainer M Krug a écrit : >> >>> Martyn Plummer writes: >>> >>>> And another 2 cents from me. >>>> >>>> A package

Re: [Rcpp-devel] Distribution of Rcpp codebase

2014-04-08 Thread Romain François
e CRAN would be impressed if I start releasing a new package for each version. > Cheers, > > Rainer > >> >> Martyn >> >> On Tue, 2014-04-08 at 10:12 +0200, Xavier Robin wrote: >>> My 2 cents... >>> >>> On 07/04/14 10:12, Romain Franç

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

2014-04-08 Thread Romain François
Hello, I have created a new mailing list (as a google group) for general discussions about R and C++. https://groups.google.com/forum/#!forum/r-and-cpp Shame that it had to come to this, but apparently Rcpp-devel is only for discussing the Dirk approved implementation of Rcpp. Personally, I

Re: [Rcpp-devel] Distribution of Rcpp codebase

2014-04-08 Thread Romain François
8 at 10:12 +0200, Xavier Robin wrote: >> My 2 cents... >> >> On 07/04/14 10:12, Romain François wrote: >>> It would also mean many copies of the same code base. To which I’m >>> thinking: so what. >> No, it will mean many copies of /many different and most

Re: [Rcpp-devel] Distribution of Rcpp codebase

2014-04-08 Thread Romain François
Le 8 avr. 2014 à 10:12, Xavier Robin a écrit : > My 2 cents... > > On 07/04/14 10:12, Romain François wrote: >> It would also mean many copies of the same code base. To which I’m thinking: >> so what. > No, it will mean many copies of /many different and mostly outdate

Re: [Rcpp-devel] Distribution of Rcpp codebase

2014-04-07 Thread Romain François
h this mailing list was about discussing R and C++, but apparently I was wrong. Fair enough if this is just Rcpp related. Perhaps I’ll leave the mailing list as I’m not that interested in Rcpp anymore. Rcpp11 has its own github issues, this I think is enough for now, but sure maybe a new mailin

Re: [Rcpp-devel] Distribution of Rcpp codebase

2014-04-07 Thread Romain François
Le 7 avr. 2014 à 19:20, Gábor Csárdi a écrit : > On Mon, Apr 7, 2014 at 9:20 AM, Romain François > wrote: > [...] >> The only small downsides I see here is that (1) users potentially have to do >> more work to include Rcpp* in their packages (although you can just write

Re: [Rcpp-devel] No no no -- Distribution of Rcpp codebase

2014-04-07 Thread Romain François
Le 7 avr. 2014 à 15:34, Dirk Eddelbuettel a écrit : > Romain, Gabor, > > Would you considerr taking this discussion elsewhere? This is a broad discussion that might be relevant to anyone doing R and C++ work. So no. > Or at least make it > very clear that you are talking about the Rcpp11, wh

Re: [Rcpp-devel] Distribution of Rcpp codebase

2014-04-07 Thread Romain François
Le 7 avr. 2014 à 15:13, Gábor Csárdi a écrit : > On Mon, Apr 7, 2014 at 4:12 AM, Romain François > wrote: > [...] > However, in terms of wins: > - package developers would know for sure which version of the codebase is > used with their package. Once they have done testin

[Rcpp-devel] Distribution of Rcpp codebase

2014-04-07 Thread Romain François
Hello, Just wanted to start a conversation about distribution of Rcpp. For a long time, distributing Rcpp has meant distributing a package (Rcpp) that contains the Rcpp library. These days, we are able to make the codebase completely header only. For example, the Rcpp11 package that I’m abou

Re: [Rcpp-devel] Yet another instance of "function 'dataptr' not provided ..."

2014-03-25 Thread Romain François
You need to import something, anything from Rcpp’s namespace. Sent you a pull request. Le 25 mars 2014 à 20:17, Douglas Bates a écrit : > I must have been away from writing R/Rcpp code for too long. > > I started off trying to reproduce a calculation that is, literally, a > one-liner in Juli

Re: [Rcpp-devel] Missing libRcpp.a and libRcpp.so

2014-03-25 Thread Romain François
As of Rcpp 0.11.0, those no longer exist. You need to rebuild your packages from source against this Rcpp. See http://r.789695.n4.nabble.com/R-pkgs-Rcpp-0-11-0-td4684675.html Romain Le 25 mars 2014 à 10:24, Florian Burkart a écrit : > Hi, > > This is probably quite straight forward but can't

Re: [Rcpp-devel] Making objects in the C++ "side" persistent

2014-03-20 Thread Romain François
Creating a package does not give you persistence of external pointers across sessions. Le 20 mars 2014 à 19:52, Dirk Eddelbuettel a écrit : > > On 20 March 2014 at 12:40, Jiqiang Guo wrote: > | RStan doesn't do anything to persist any c++ object. What's done is to save > | the binary file cr

Re: [Rcpp-devel] Rcpp module support

2014-02-26 Thread Romain François
Rcpp11 is an alternative implementation of Rcpp indeed. It does not mean discussing it is not suitable to this mailing list. Rcpp11 will be released closely after R 3.1.0, whenever this happens to be. It contains major improvements over Rcpp, will be completely header only (no src/ directory a

Re: [Rcpp-devel] Avoiding having to write .h files

2014-02-25 Thread Romain François
> Søren > > -Original Message----- > From: Romain François [mailto:rom...@r-enthusiasts.com] > Sent: 25. februar 2014 12:39 > To: Søren Højsgaard > Cc: rcpp-devel@lists.r-forge.r-project.org (rcpp-de...@r-forge.wu-wien.ac.at) > Subject: Re: [Rcpp-devel] Avoiding ha

Re: [Rcpp-devel] Avoiding having to write .h files

2014-02-25 Thread Romain François
Hello, Why do you want to avoid writing headers. I guess you could use extern For example, in foo1.cpp : double fun1(){ return 2.0 ; } In foo2.cpp ; extern double fun1() ; double fun2(){ return fun1() + 2; } Romain Le 25 févr. 2014 à 12:28, Søren Højsgaard a écrit : > Dear all, >

Re: [Rcpp-devel] Deriving type information

2014-02-13 Thread Romain François
In addition to what Kevin said, perhaps you are looking for macros from this file: https://github.com/RcppCore/Rcpp/blob/master/inst/include/Rcpp/macros/dispatch.h Le 14 févr. 2014 à 00:34, Søren Højsgaard a écrit : > Dear all, > > Function foo_num below takes a numeric vector and returns a li

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, > I was experiment

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 change > of #include's

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, > > I am

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

2014-01-21 Thread Romain François
Hi, There is a preliminary version of this in Rcpp11. For example: #include using namespace Rcpp ; // [[Rcpp::export]] NumericVector test(){ NumericVector x(10) ; NumericVector y(30) ; return NumericVector::concat(x, 2.0, y, 1.0) ; } So it handles (or at least it should): - compatibl

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

2014-01-21 Thread Romain François
Le 22 janv. 2014 à 01:10, Kevin Ushey a écrit : > Hi Søren, > > I like the idea. Currently there is nothing like that in Rcpp. It > could be made more flexible if we: > > 1. Accept a generic set of vectors that could be appropriately casted as > needed, > 2. Cast these vectors to the appropri

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

2014-01-21 Thread Romain François
Hi, There is currently nothing like that. It is quite hard to generalize. You might like std::merge, e.g. template Vec do_conc_(Vec x, Vec y){ Vec out=no_init(x.size()+y.size()); std::merge( x.begin(), x.end(), y.begin(), y.end(), out.begin() ) ; return out; } We could want to general

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, > > I

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

2013-12-10 Thread Romain François
Le 9 déc. 2013 à 23:14, Søren Højsgaard a écrit : > Dear all, > Using RcppEigen I've created a function for converting a sparse matrix (a > dgCMatrix) to a standard dense matrix: > > typedef Eigen::SparseMatrix SpMatd; > typedef Eigen::MappedSparseMatrix MSpMat; > > // [[Rcpp::export]] > SEXP

Re: [Rcpp-devel] IntegerVector initialization

2012-01-15 Thread Romain François
Le 12/01/12 11:29, Gregor Kastner a écrit : This is a minor thing but caused some confusion to me: IntegerVector foo1(2, 4.0); // works IntegerVector foo2(2, 4);// throws error while IntegerVector bar1 = IntegerVector::create(4.0, 4.0); // works IntegerVector bar2 = IntegerVector::create

Re: [Rcpp-devel] Idiom for accessing scalars

2012-01-07 Thread Romain François
Le 07/01/12 18:55, Dirk Eddelbuettel a écrit : On 7 January 2012 at 18:40, Romain François wrote: | Le 07/01/12 18:36, Douglas Bates a écrit : |> On Sat, Jan 7, 2012 at 10:55 AM, Dirk Eddelbuettel wrote: |>> On 7 January 2012 at 10:04, Douglas Bates wrote: |>> | 2012/1/7

Re: [Rcpp-devel] Idiom for accessing scalars

2012-01-07 Thread Romain François
Le 07/01/12 18:36, Douglas Bates a écrit : On Sat, Jan 7, 2012 at 10:55 AM, Dirk Eddelbuettel wrote: On 7 January 2012 at 10:04, Douglas Bates wrote: | 2012/1/7 Romain François: |> Le 06/01/12 20:46, Douglas Bates a écrit : |> |>> On Fri, Jan 6, 2012 at 1:12 PM, Dirk Eddelbuett

Re: [Rcpp-devel] Idiom for accessing scalars

2012-01-07 Thread Romain François
Le 07/01/12 17:04, Douglas Bates a écrit : 2012/1/7 Romain François: Le 06/01/12 20:46, Douglas Bates a écrit : On Fri, Jan 6, 2012 at 1:12 PM, Dirk Eddelbuettelwrote: On 6 January 2012 at 12:59, Douglas Bates wrote: | On Fri, Jan 6, 2012 at 12:39 PM, John Chambers wrote: |>

Re: [Rcpp-devel] Optimising 2d convolution

2012-01-07 Thread Romain François
Hi, Using some of what we know about the structure of an R matrix, we can use this version: convolve_2d_tricks <- cxxfunction(signature(sampleS = "numeric", kernelS = "numeric"), plugin = "Rcpp", ' Rcpp::NumericMatrix sample(sampleS), kernel(kernelS); int x_s = sample.nrow(), x_k = ker

Re: [Rcpp-devel] When does using iterators for subscripting help?

2012-01-07 Thread Romain François
I thought I could make a difference by trying some loop unrolling voodoo, with this macro: #define LOOP_UNROLL(EXPR) \ int __trip_count = n >> 2 ; \ int i = 0 ; \ for ( ; __trip_count > 0 ; --__trip_count) { \ EXPR ;

Re: [Rcpp-devel] Idiom for accessing scalars

2012-01-07 Thread Romain François
Le 06/01/12 20:46, Douglas Bates a écrit : On Fri, Jan 6, 2012 at 1:12 PM, Dirk Eddelbuettel wrote: On 6 January 2012 at 12:59, Douglas Bates wrote: | On Fri, Jan 6, 2012 at 12:39 PM, John Chambers wrote: |> The "Rf_" part of the API in particular is ugly and somewhat of an add-on |> forced

Re: [Rcpp-devel] Segfaults

2012-01-04 Thread Romain François
Le 04/01/12 15:55, Steve Lianoglou a écrit : Woops -- seems I misdiagnosed the cause of error, please ignore :-) Still, I'm surprised the attempted logical (NA) to Numeric conversion isn't a source of some potential woes, too? That is because the NumericVector constructor coerces the logical to

Re: [Rcpp-devel] Segfaults

2012-01-04 Thread Romain François
Le 04/01/12 15:55, Hadley Wickham a écrit : So your i_[0] - 1 is also nan. You are responsible for dealing with na. You can use traits::is_na: fx<- cxxfunction( signature( x_ = "numeric"), ' double x = as(x_) ; if( traits::is_na(x) ){ // do something } else { // do

Re: [Rcpp-devel] Segfaults

2012-01-04 Thread Romain François
Le 04/01/12 15:33, Hadley Wickham a écrit : Hi all, Is it a bug to cause a segfault with Rcpp? Or are am I doing something so dumb that an automatic check could never protect? See minimal reproducible example below. Hadley library(inline) f<- cxxfunction(signature(x = "numeric", i = "numeric"

Re: [Rcpp-devel] When does using iterators for subscripting help?

2012-01-04 Thread Romain François
Hi, NumericVector:::iterator is actually alias to double*. Here is a trick (probably does not work on not gcc compilers): > cxxfunction( , 'Rprintf( "%s", DEMANGLE(NumericVector::iterator)); ', plugin = "Rcpp" )() double*NULL We did good on the NumericVector::operator[] to optimize it as mu

Re: [Rcpp-devel] Idiom for accessing scalars

2012-01-04 Thread Romain François
Le 04/01/12 14:29, Hadley Wickham a écrit : Hi all, I'm still just getting my feet wet in Rcpp, so please excuse the naivety of my question, but is this the appropriate idiom for treating an input as a C++ scalar? f<- cxxfunction(signature(x = "integer"), plugin = "Rcpp", ' Rcpp::IntegerVect

Re: [Rcpp-devel] Compilation on MAC OS X 10.7.2

2011-12-07 Thread Romain François
on in my program. The error comes from the inclusion of (line 91) in my main.cpp And the package compiles fine under Linux. Rémi Le 7 déc. 2011 à 16:59, Romain François a écrit : Bonjour Remi, Could you send a reproducible example using tr1::unordered_map so that we can help you. Cordial

Re: [Rcpp-devel] Compilation on MAC OS X 10.7.2

2011-12-07 Thread Romain François
Bonjour Remi, Could you send a reproducible example using tr1::unordered_map so that we can help you. Cordialement, Romain Le 07/12/11 16:55, Rémi Lebret a écrit : Hi, I got this error when I'm trying to compile my package using Rcpp : g++-4.2 -arch i386 -I/Library/Frameworks/R.framework/

Re: [Rcpp-devel] Using printf: Error in source("/tmp/printf.r") : /tmp/printf.r:8:11: unexpected input

2011-11-18 Thread Romain François
This has nothing to do with printf, this is simply because you use double quotes 'inside' double quotes, replace the outer quotes by single quotes and you should be fine. Please also note that Rprintf is preferred, because it will work on all platforms or user interfaces. Hope this helps, R

Re: [Rcpp-devel] deprecated functionality in Armadillo 2.3.x / 2.4.x and onwards

2011-11-16 Thread Romain François
Le 17/11/11 07:47, c s a écrit : On Thu, Nov 17, 2011 at 1:54 PM, Dirk Eddelbuettel wrote: Cool, thanks. While I have your attention: the R and the CRAN infrastructure now also test for use of std::cout in linked-in libraries (as R has its own i/o buffering; one shall not mix with iostreams):

Re: [Rcpp-devel] multiple function when using Inline

2011-10-20 Thread Romain François
Hello, You are crossing the boundary when it really starts to make sense to make a package. If you only have one R facing C++ function calling other C++ functions, then you can abuse the includes argument of cxxfunction to embed as many C++ functions as you like. Having multiple R facing fun

Re: [Rcpp-devel] Question regarding integrating preexisting C++ code via Rcpp

2011-10-10 Thread Romain François
Hello, It looks like you want to use Rcpp modules. See the "Rcpp-modules" vignette. > require( Rcpp ) > vignette( "Rcpp-modules" ) Or from CRAN: http://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-modules.pdf Modules are still in (slow) dev, so they lack some features, but what exists

Re: [Rcpp-devel] Strange behavior of NumericMatrix

2011-09-20 Thread Romain François
9 11 10 13 -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building #8208 Los Angeles, CA 90095 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/li

Re: [Rcpp-devel] R CMD check not happy about -std=c++0x

2010-01-16 Thread Romain François
> > On 15 January 2010 at 14:26, Romain François wrote: > | On 01/15/2010 02:15 PM, Dirk Eddelbuettel wrote: > |> > |> On 15 January 2010 at 08:27, Romain François wrote: > |> | I'm getting a warning when I try to build my CPP package that depends on > |&

Re: [Rcpp-devel] R CMD check not happy about -std=c++0x

2010-01-15 Thread Romain François
On 01/15/2010 02:15 PM, Dirk Eddelbuettel wrote: > > On 15 January 2010 at 08:27, Romain François wrote: > | I'm getting a warning when I try to build my CPP package that depends on > | Rcpp and uses the classic Makevars : > | > | PKG_CXXFLAGS=`Rcpp:::CxxFlags()` -I. >

Re: [Rcpp-devel] Adminstrivia

2010-01-15 Thread Romain François
On 01/14/2010 08:17 PM, Dirk Eddelbuettel wrote: > > i) Romain suggested to uncouple the commits list from this one, which I have > now done. If you would like to receive messages about commits, please > subscribe to rcpp-commits at R-forge. > > [ If you'd rather see this reverted,

[Rcpp-devel] R CMD check not happy about -std=c++0x

2010-01-14 Thread Romain François
Hi, I'm getting a warning when I try to build my CPP package that depends on Rcpp and uses the classic Makevars : PKG_CXXFLAGS=`Rcpp:::CxxFlags()` -I. PKG_LIBS=`Rcpp:::LdFlags()` I get this warning from R CMD check : * checking for portable compilation flags in Makevars ... WARNING Non-portab