Re: [Rcpp-devel] R & RcppArmadillo decomposition disagreement

2013-05-30 Thread Colin Rundel
> reference blas (packages libblas3 and liblapack) > atlas (package libatlas3-base or a tuned variant) > open-blas (package libopenblas-base) I had been playing around with update-alternatives to swap between the three, but just in case this was causing issues I've used apt

Re: [Rcpp-devel] Simplest Class Example For Starters

2013-05-30 Thread Dirk Eddelbuettel
On 30 May 2013 at 18:08, ivo welch wrote: | hi dirk---it is indeed excellent.  alas, it doesn't cover my confusion. I reckon you did not read 'Rcpp attributes' carefully enough. Please do read it again. | determines whether one needs to declare attributes vs. Rcpp being smart enough One has to

Re: [Rcpp-devel] R & RcppArmadillo decomposition disagreement

2013-05-30 Thread Dirk Eddelbuettel
On 30 May 2013 at 20:46, Colin Rundel wrote: | Hi everyone, | | I have recently run into a strange situation with RcppArmadillo and was hoping someone might have some insight. I am working with a moderately sized (820x820) covariance matrix in C++ which causes arms::chol to fail. In trying to

Re: [Rcpp-devel] Simplest Class Example For Starters

2013-05-30 Thread ivo welch
hi dirk---it is indeed excellent. alas, it doesn't cover my confusion. *general*: I now realize my first problem with the print function. I need to double-escape '\'. cppFunction('int hello(int i) { printf("hello, world\n"); }') is wrong. it needs to be cppFunction('int hello(int i) { pri

Re: [Rcpp-devel] Turning a vector into a matrix

2013-05-30 Thread Dirk Eddelbuettel
Soren, You missed the most appropriate constructor: template Matrix( const int& nrows_, const int& ncols, Iterator start ) ; With that we just do this: R> Rcpp::sourceCpp('/tmp/soren.cpp') R> soren(1:4,2,2) [,1] [,2] [1,]13 [2,]24 R> and the file s

Re: [Rcpp-devel] R & RcppArmadillo decomposition disagreement

2013-05-30 Thread alexios ghalanos
No problem on my windows machine (and returned values checked are equal). R version 3.0.1 (2013-05-16) Platform: x86_64-w64-mingw32/x64 (64-bit) [1] RcppArmadillo_0.3.800.1 Rcpp_0.10.3 -Alexios On 31/05/2013 01:46, Colin Rundel wrote: Hi everyone, I have recently run into a strange situation

[Rcpp-devel] R & RcppArmadillo decomposition disagreement

2013-05-30 Thread Colin Rundel
Hi everyone, I have recently run into a strange situation with RcppArmadillo and was hoping someone might have some insight. I am working with a moderately sized (820x820) covariance matrix in C++ which causes arms::chol to fail. In trying to diagnose the issue I have written out the offending

[Rcpp-devel] Turning a vector into a matrix

2013-05-30 Thread Søren Højsgaard
Dear all Apologies for a trivial question. I want to turn the vector vec <- 1:4 into a matrix 1 3 2 3 I do: src1 <-' NumericVector vec(vec_); NumericMatrix mat( as(nrow_), as(ncol_) ); for(int ii=0; iihttps://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] Simplest Class Example For Starters

2013-05-30 Thread Dirk Eddelbuettel
On 30 May 2013 at 15:08, ivo welch wrote: | | thx, dirk.  first, apologies for multiposting earlier.  I thought it did not | allow me to post from my non-registered email address.  second, apologies for | the private email.  I wasn't expecting any answers.  just wanted to help with | some feedbac

Re: [Rcpp-devel] Simplest Class Example For Starters

2013-05-30 Thread ivo welch
thx, dirk. first, apologies for multiposting earlier. I thought it did not allow me to post from my non-registered email address. second, apologies for the private email. I wasn't expecting any answers. just wanted to help with some feedback. I will buy your Rcpp book when it comes out. I th

Re: [Rcpp-devel] Simplest Class Example For Starters

2013-05-30 Thread Dirk Eddelbuettel
Ivo, Appreciate that you post here. Am a little pressed for time but in a nutshell, you missed that the new (and very nice) Rcpp Attributes which you use for sourceCpp do NOT currently mix with Rcpp Modules. So either concentrate on easily writing accessor function, OR concentrate on using Modu

[Rcpp-devel] Simplest Class Example For Starters

2013-05-30 Thread ivo welch
dear readers: I am trying to learn how to interface a simple C++ class into the underbelly of R. I don't plan to use this regularly---just for one or two applications. I read the introduction and faq vignettes and hadley's tutorial. alas, I am mixing and matching badly. I also don't have the

[Rcpp-devel] Simplest Class Example For Starters

2013-05-30 Thread ivo welch
dear readers: I am trying to learn how to interface a simple C++ class into the underbelly of R. I read the introduction and faq vignettes and hadley's tutorial. alas, I am mixing and matching badly. I also don't have the full template programming background, which dates me, and the examples

Re: [Rcpp-devel] [RCPP Sugar] sapply function

2013-05-30 Thread Romain Francois
Le 10/05/13 17:40, Julien Duvanel a écrit : Hello again, I hope I don't disturb you too much. I have again a small question. I haven't seen the answer on your vignette, maybe this is not possible. Here's what I would like to do : /double Foo(double x, double a1, double a2) {/ /return f(x,a1,a2)

Re: [Rcpp-devel] How to access fields and methods of a RefClass from C++?

2013-05-30 Thread Dirk Eddelbuettel
On 30 May 2013 at 18:01, Romain Francois wrote: | Le 30/05/13 16:02, Dirk Eddelbuettel a écrit : | > | > On 30 May 2013 at 15:15, Romain Francois wrote: | > | More easily, you can use Rcpp::Reference: | > | | > | // [[Rcpp::export]] | > | std::string getId(Reference obj) { | > | std::string t

Re: [Rcpp-devel] unloading/reloading Rcpp based custom package crashes my R session

2013-05-30 Thread Dirk Eddelbuettel
On 30 May 2013 at 17:55, Anwar Ludin wrote: | Yes I noticed that RStudio was restarting the session whenever you | rebuild the package. I guess RStudio does this in order to make sure | that the session is clean. I am however a bit worried from an RStudio | end-user's perspective because the pa

Re: [Rcpp-devel] How to access fields and methods of a RefClass from C++?

2013-05-30 Thread Romain Francois
Le 30/05/13 16:02, Dirk Eddelbuettel a écrit : On 30 May 2013 at 15:15, Romain Francois wrote: | More easily, you can use Rcpp::Reference: | | // [[Rcpp::export]] | std::string getId(Reference obj) { | std::string txt = obj.field("id"); | return txt; | } Thanks -- had forgotten about

Re: [Rcpp-devel] unloading/reloading Rcpp based custom package crashes my R session

2013-05-30 Thread Anwar Ludin
Hi Dirk, Yes I noticed that RStudio was restarting the session whenever you rebuild the package. I guess RStudio does this in order to make sure that the session is clean. I am however a bit worried from an RStudio end-user's perspective because the package can be loaded/unloaded using the pa

Re: [Rcpp-devel] MQL2R

2013-05-30 Thread Dirk Eddelbuettel
Hi James, On 30 May 2013 at 23:01, James Bates wrote: | Hi All, | | Just a quick not to say that I have released my Rcpp/RInside based project | MQL2R on google code. It allows you to utilise the power of R with the highly | popular Metatrader trading platoform to create analytics, indicators an

Re: [Rcpp-devel] unloading/reloading Rcpp based custom package crashes my R session

2013-05-30 Thread Dirk Eddelbuettel
Anwar, On 30 May 2013 at 16:59, Anwar Ludin wrote: | I am experiencing a strange behaviour when unloading/reloading a custom | package written using Rcpp. The initial load works perfectly and I can | use the package as intended. I my experience you will be best off simply by restarting R. Whe

Re: [Rcpp-devel] unloading/reloading Rcpp based custom package crashes my R session

2013-05-30 Thread Anwar Ludin
I've attached the source package to this mail. On 05/30/2013 04:59 PM, Anwar Ludin wrote: Hello, I am experiencing a strange behaviour when unloading/reloading a custom package written using Rcpp. The initial load works perfectly and I can use the package as intended. library(RiskCetera

[Rcpp-devel] MQL2R

2013-05-30 Thread James Bates
Hi All, Just a quick not to say that I have released my Rcpp/RInside based project MQL2R on google code. It allows you to utilise the power of R with the highly popular Metatrader trading platoform to create analytics, indicators and automated trading signals. Take a look at https://code.google.co

[Rcpp-devel] unloading/reloading Rcpp based custom package crashes my R session

2013-05-30 Thread Anwar Ludin
Hello, I am experiencing a strange behaviour when unloading/reloading a custom package written using Rcpp. The initial load works perfectly and I can use the package as intended. library(RiskCeteraPricing) ## everything OK When unloading the package I get the following warning: detach("

Re: [Rcpp-devel] How to access fields and methods of a RefClass from C++?

2013-05-30 Thread Dirk Eddelbuettel
On 30 May 2013 at 15:15, Romain Francois wrote: | More easily, you can use Rcpp::Reference: | | // [[Rcpp::export]] | std::string getId(Reference obj) { | std::string txt = obj.field("id"); | return txt; | } Thanks -- had forgotten about that one. Would you mind cooking up a quick u

Re: [Rcpp-devel] How to access fields and methods of a RefClass from C++?

2013-05-30 Thread Romain Francois
More easily, you can use Rcpp::Reference: // [[Rcpp::export]] std::string getId(Reference obj) { std::string txt = obj.field("id"); return txt; } Here, you are isolated from the implementation of reference classes using environments and the .xData slot name. Romain Le 29/05/13 01:49,

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