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

2014-07-23 Thread Asis Hallab
Dear Rcpp-Experts, trying to optimize my algorithm I face the question wether a lookup by a string key like e.g. myRcppList( "my_entry" ) is as fast as the lookup in std::maps? That said, would you recommend converting myRcppList to a std::map before searching it? Thank you for your help in adv

Re: [Rcpp-devel] How to set stringsAsFactors=FALSE in Rcpp::DataFrame?

2014-07-22 Thread Asis Hallab
Dear Dirk, many thanks for the provided solution. Cheers! 2014-07-22 13:35 GMT+02:00 Dirk Eddelbuettel : > > On 22 July 2014 at 12:59, Asis Hallab wrote: > | Dear Rcpp-Experts, > | > | how can I get the equivalent of the R expression > | > | my.df <- data.frame( …

[Rcpp-devel] How to set stringsAsFactors=FALSE in Rcpp::DataFrame?

2014-07-22 Thread Asis Hallab
Dear Rcpp-Experts, how can I get the equivalent of the R expression my.df <- data.frame( …, stringsAsFactors=FALSE ) in Rcpp? I have this code in Rcpp: … return( DataFrame::create( Named( "acc" ) = accsCol, Named( "ec" )= ecCol, Named( "prot.acc" ) = protC

[Rcpp-devel] Equivalent to the which function in Rcpp / Access to a data.frame's indices?

2014-07-18 Thread Asis Hallab
Dear Rcpp-Experts, in Rcpp I want to quickly identify matching rows in a data.frame. In R I would do the following: matching.rows <- my.data.frame[ which( my.data.frame$column.of.interest == 'value_of_interest' ), ] How to do something similar in Rcpp? If I am not mistaken R data.frames and mat

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

2013-12-30 Thread Asis Hallab
Dear Rcpp experts, I need to select all unique un-ordered pairs from a two column table. Here each row represents a pair and two rows, un-ordered pairs p and q are identical if either first and second elements of p and q are identical, respectively, or if first element of p is identical to second

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

2013-12-29 Thread Asis Hallab
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++ standard approach for very large std::vectors would be to first sort them and the

Re: [Rcpp-devel] Conversion of Rcpp::Vector Rcpp::List and Rcpp::Matrix to std objects - OpenMP

2013-06-03 Thread Asis Hallab
= 1.0 - compAnnoMutProb; > cpt( _, i ) = colmn; > I think, you could write this immediately into 'cpt'? > > 8) Use instruments for testing: A very good introduction and an overview can > be found on the website of the HPC-Cluster in Aachen (to which by the way > you

[Rcpp-devel] When to use SEXP as return value or argument type?

2013-06-03 Thread Asis Hallab
Dear Rcpp Experts, two simple and short questions: Do I always have to use SEXP arguments, if I want the method to be callable from R through the .Call( … ) function? Does the return type have to be a SEXP, too, or can I use any Rcpp class instead? Kind regards!

Re: [Rcpp-devel] Conversion of Rcpp::Vector Rcpp::List and Rcpp::Matrix to std objects - OpenMP

2013-06-03 Thread Asis Hallab
Dear Dirk, Simon and Rcpp Experts. This is a message following up the thread about using OpenMP directives with Rcpp to construct probability matrices in parallel. I followed Dirk's hint and implemented the parallel matrix generation using just C++'s STL and the "#pragma omp parallel for" for the

[Rcpp-devel] Rcpp is the best - praise to the praise worthy

2013-06-02 Thread Asis Hallab
Dear Dirk Eddelbuettel, Romain Francois and contributors, Dear Rcpp Experts! It is time to praise you and express my thanks. I had a very annoying problem generating up to a 300 square matrices each of sizes up to 500*500 cells. Computing their numeric cell entries took for ages, even when done u

Re: [Rcpp-devel] Conversion of Rcpp::Vector Rcpp::List and Rcpp::Matrix to std objects - OpenMP

2013-06-01 Thread Asis Hallab
Dear Simon, thank you very much for your insights and offer to help. I prepared a very small project on github: https://github.com/asishallab/PhyloFun_Rccp You'll find installation and test instructions as well as references to the file containing the OpenMP using C++ code. Your help is much ap

Re: [Rcpp-devel] Conversion of Rcpp::Vector Rcpp::List and Rcpp::Matrix to std objects - OpenMP

2013-06-01 Thread Asis Hallab
Dear Dirk and Simon, thank you very much for your help. I have made a few experiments and am very puzzled. Maybe I could bother you with advise on this? The experiments on a #pragma omp parallel for 1) Use private directive on all Rcpp-Objects that are only accessed to be read from, and a share

[Rcpp-devel] Conversion of Rcpp::Vector Rcpp::List and Rcpp::Matrix to std objects - OpenMP

2013-05-31 Thread Asis Hallab
Dear Rcpp Experts, in my current project I wanted to make use of OpenMP. Unfortunately it seems Rcpp Objects cannot be used inside a block executed in parallel. Seg fault errors are the consequence, according to Dirk's reply in this thread http://lists.r-forge.r-project.org/pipermail/rcpp-devel/20

Re: [Rcpp-devel] Are there any C++ function name restrictions?

2013-05-30 Thread Asis Hallab
Dear Dirk, Dale and Rcpp advisors, thank you very much for your help. Finally with your help the source of my problem could be identified. It was the way I reloaded the newly build and changed package. Searching the web I had found the following R command sequence to reload a package: detach( 'p

Re: [Rcpp-devel] Are there any C++ function name restrictions?

2013-05-29 Thread Asis Hallab
Dear Dirk, Hadley and Rccp Experts, thank you very much for your input. Unfortunately I still cannot solve my problem. I took Dirk's advise and used Rcpp.package.skeleton(name="foobar") to create a new Hello-World package. Then I build and installed it with R CMD INSTALL foobar/ >From an interac

[Rcpp-devel] Are there any C++ function name restrictions?

2013-05-29 Thread Asis Hallab
Dear Rcpp Experts, hopefully this question of mine is not too stupid. Well, I am a greenhorn with Rcpp and my C/C++ expertise is quite dusty. I generated a new Rccp package and changed the hello_world function. The attached Rcpp Code stops working if I rename the method "rcpp_hello_world" to "co

Re: [Rcpp-devel] [R] Rcpp with OpenMP - Need example Makevars

2013-05-24 Thread Asis Hallab
Many thanks to Dirk and Brian! The tips helped me a lot. Kind regards! ___ 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

[Rcpp-devel] Rcpp with OpenMP - Need example Makevars

2013-05-24 Thread Asis Hallab
Dear R experts, recently I started developing a Rcpp package "OpenMPTest". Within that package I want to use OpenMP, as in the following code example: // header file #include using namespace Rcpp ; RcppExport SEXP testOpenMP( SEXP nThreads ) ; // cpp file SEXP testOpenMP( SEXP nThreads ) { BE