Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Dirk Eddelbuettel
On 11 July 2013 at 19:21, Gabor Grothendieck wrote: | 1. Just to be clear what we have been discussing here is not just how to | avoid copying but how to avoid copying while using as and wrap | or approaches that automatically generate as and wrap. I was already | aware of how to avoid copying us

Re: [Rcpp-devel] how to pass -fPIC instead of -fpic when building rccp package

2013-07-11 Thread Dirk Eddelbuettel
Anwar, On 12 July 2013 at 01:42, Anwar Ludin wrote: | Yes I agree, I'm just having issues with the way the build process works, so let's make it a Rcpp problem ;) | | >library(Rcpp) | >Rcpp.package.skeleton("testpackage") | | R CMD INSTALL --preclean --no-multiarch testpackage | | icpc -I/usr

Re: [Rcpp-devel] how to pass -fPIC instead of -fpic when building rccp package

2013-07-11 Thread Anwar Ludin
Hi Dirk, Yes I agree, I'm just having issues with the way the build process works, so let's make it a Rcpp problem ;) >library(Rcpp) >Rcpp.package.skeleton("testpackage") R CMD INSTALL --preclean --no-multiarch testpackage icpc -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/usr/lib64/R/l

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Gabor Grothendieck
1. Just to be clear what we have been discussing here is not just how to avoid copying but how to avoid copying while using as and wrap or approaches that automatically generate as and wrap. I was already aware of how to avoid copying using Armadillo how to use Armadillo types as arguments and ret

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Dirk Eddelbuettel
Everybody has this existing example in their copy of Armadillo. I am running it here from SVN rather than the installed directory, but this should not make a difference. Machine is my not-overly-powerful thinkpad used for traveling: edd@don:~/svn/rcpp/pkg/RcppArmadillo/inst/examples$ r fastLm.r

Re: [Rcpp-devel] how to pass -fPIC instead of -fpic when building rccp package

2013-07-11 Thread Dirk Eddelbuettel
On 11 July 2013 at 15:12, Anwar Ludin wrote: | Hello, | | When building a rcpp package is there a way of forcing -fPIC instead of -fpic during package compilation? I 'm using RStudio as my main IDE and the package is built using That is an RStudio question, and they have it all documented. Se

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Dirk Eddelbuettel
On 11 July 2013 at 21:34, Changi Han wrote: | I am sure there are better ways to achieve the goal. I would suggest that these | two be similar if possible. I think the naive expectation is for them to be | consistent. | | // [[Rcpp::export]] | stuff function(Rcpp::stuff) { | } | | // [[Rcpp::ex

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Dirk Eddelbuettel
On 11 July 2013 at 10:33, baptiste auguie wrote: | Hi, | | That's great, thanks for considering this! | | Following this discussion, I went to browse through my code looking for wrap() | and as() statements that could benefit from a speed-up of memory reuse. Of | course I didn't find any.  | I s

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread romain
These __are__ similar. The difference is in the classes themselves. Rcpp classes are proxy classes so C++ copy mechanism does not apply to them. arma classes are proper c++ classes, so C++ semantics apply. I'm at useR right now, so I can't really work on this. I'll submit at least ideas later.

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Changi Han
I am sure there are better ways to achieve the goal. I would suggest that these two be similar if possible. I think the naive expectation is for them to be consistent. // [[Rcpp::export]] stuff function(Rcpp::stuff) { } // [[Rcpp::export]] stuff function(arma::stuff) { } Thank you again. Cheers.

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread baptiste auguie
Hi, That's great, thanks for considering this! Following this discussion, I went to browse through my code looking for wrap() and as() statements that could benefit from a speed-up of memory reuse. Of course I didn't find any. I switched to using Modules when they were introduced, the code being

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread romain
Hello, This comes up every now and then, I think we can find a syntax to initiate an arma::mat that would allow what you want. It is not likely it will come via attributes. The idea is to keep them simple. The solutions I see below would eventually lead to clutter, and we are heading in the

[Rcpp-devel] how to pass -fPIC instead of -fpic when building rccp package

2013-07-11 Thread Anwar Ludin
Hello, When building a rcpp package is there a way of forcing -fPIC instead of -fpic during package compilation? I 'm using RStudio as my main IDE and the package is built using R CMD INSTALL --preclean --no-multiarch Thanks! ___ Rcpp-devel mailing

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Gabor Grothendieck
On Thu, Jul 11, 2013 at 8:56 AM, Changi Han wrote: > I entirely missed that thread ... sorry. I came across the above examples > at: > > http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-April/005680.html > > > On Thu, Jul 11, 2013 at 8:38 PM, Gabor Grothendieck > wrote: >> >> On Thu,

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Changi Han
I entirely missed that thread ... sorry. I came across the above examples at: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-April/005680.html On Thu, Jul 11, 2013 at 8:38 PM, Gabor Grothendieck wrote: > On Thu, Jul 11, 2013 at 8:32 AM, Changi Han > wrote: > > Hello, > > > > I t

Re: [Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Gabor Grothendieck
On Thu, Jul 11, 2013 at 8:32 AM, Changi Han wrote: > Hello, > > I think I (superficially) understand the difference between: > > // [[Rcpp::export]] > double sum1(Rcpp::NumericMatrix M) { > arma::mat A(M.begin(), M.rows(), M.cols(), false); > return sum(sum(A)); > } > > > // [[Rcpp::export

[Rcpp-devel] Forcing a shallow versus deep copy

2013-07-11 Thread Changi Han
Hello, I think I (superficially) understand the difference between: // [[Rcpp::export]] double sum1(Rcpp::NumericMatrix M) { arma::mat A(M.begin(), M.rows(), M.cols(), false); return sum(sum(A)); } // [[Rcpp::export]] double sum2(arma::mat A) { return sum(sum(A)); } Partly out of l

Re: [Rcpp-devel] copying or not when convering to arma

2013-07-11 Thread Gabor Grothendieck
On Thu, Jul 11, 2013 at 3:50 AM, Dirk Eddelbuettel wrote: > > On 10 July 2013 at 11:58, Gabor Grothendieck wrote: > | Suppose we have this program where we have started and ended with SEXP > | and written out the as and wrap conversions to make them explicit. > | > | How many times is the data cop

Re: [Rcpp-devel] Unable to load shared object

2013-07-11 Thread Dirk Eddelbuettel
Jules, On 10 July 2013 at 11:18, Jules Archer wrote: | Dirk, | | Thank you for your fast reply! | | With regard to your specific suggestions: | | |Two suggestions. First, try creating a simple package without MathGL just to | |make sure you have that process of going from sourceCpp via compil

Re: [Rcpp-devel] copying or not when convering to arma

2013-07-11 Thread Dirk Eddelbuettel
On 10 July 2013 at 11:58, Gabor Grothendieck wrote: | Suppose we have this program where we have started and ended with SEXP | and written out the as and wrap conversions to make them explicit. | | How many times is the data copied? | Does as copy the underlying data? | Does wrap? | Is it copied