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

2012-12-11 Thread Honglang Wang
Dear All, I have modified the code as following. Since I found the old code had the memory allocation issue, I calculated each term of the matrix with dim 4. The speed is pretty much good now. But since I am not familiar with Rcpp, the code sometimes will get error, like *** caught segfault *** a

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

2012-12-11 Thread Honglang Wang
I tried out that if the dim of the matrix less than or equal to 4, inv() and solve() have the same speed. 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 On Mon

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

2012-12-11 Thread hickey
Romain - Wonderful! Thank you so much for your examples. I'll add this to my function tomorrow. Pete Peter Hickey, PhD Student/Research Assistant, Bioinformatics Division, Walter and Eliza Hall Institute of Medical Research, 1G Royal Parade, Parkville, Vic 3052, A

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

2012-12-11 Thread Romain Francois
Or (from svn rev 4144), you can use the collapse funtion: // [[Rcpp::export]] CharacterVector pasteColumns2(CharacterMatrix m){ int nr = m.nrow() ; CharacterVector out(nr) ; for( int i=0; i Hello, We don't know your function f, so this is hard to say. Anyway, this below implements s