Re: [Rcpp-devel] [rcpp-devel] arma::mat constructor vs Rcpp::as and interaction with .insert_col

2013-04-11 Thread Conrad S
On Fri, Apr 12, 2013 at 11:12 AM, Dale Smith wrote: > > fastLm(y, mat) # error is "error: Mat::init(): mismatch between size of > auxiliary memory and requested size" There is a further option within the Mat constructor, which when used should prevent this error. Specifically, we have: mat(aux_

Re: [Rcpp-devel] [rcpp-devel] arma::mat constructor vs Rcpp::as and interaction with .insert_col

2013-04-11 Thread Dirk Eddelbuettel
Dale, Here is a simple fix: just _join_ the matrix and the col vector. Result first (now with set.seed(42), so rngs different) R> sourceCpp("/tmp/dale.cpp") R> set.seed(42) ## needed !! R> mat <- cbind(rnorm(50), rnorm(50), rnorm(50)) R> y <- rnorm(50) R> fastLm2(y, mat) $coefficients

Re: [Rcpp-devel] [rcpp-devel] arma::mat constructor vs Rcpp::as and interaction with .insert_col

2013-04-11 Thread Dirk Eddelbuettel
Hi Dale, On 11 April 2013 at 21:12, Dale Smith wrote: | I had a problem this afternoon with an arma::mat constructor and the | mat::insert_col method. That is not a method I've used, I think, so I will defer comments. Whenever I did what you do below (ie expand a N*k matrix with a standard 'i

[Rcpp-devel] [rcpp-devel] arma::mat constructor vs Rcpp::as and interaction with .insert_col

2013-04-11 Thread Dale Smith
Hello, I had a problem this afternoon with an arma::mat constructor and the mat::insert_col method. Since I got the example from Dirk, I thought I would point out the problem I had and a solution. See http://gallery.rcpp.org/articles/fast-linear-model-with-armadillo/ for background. Before I g

Re: [Rcpp-devel] Rcpp, bigmemory, package creation

2013-04-11 Thread Alex Ustian
All right! I think I have it figured out, at least for the toy functions/package. What wasn't compiling wasn't my functions, it was RcppExports.cpp. sourceCpp (and hence also the knit example) have been working for me all along. The only issue (apparently) was that RcppExports.cpp was not includ

Re: [Rcpp-devel] Rcpp, bigmemory, package creation

2013-04-11 Thread Dirk Eddelbuettel
On 11 April 2013 at 16:14, Alex Ustian wrote: | Sorry to be dense, but you mean to copy and paste the source into an Rmd file | and knit it?  If yes, then I did just that and it did work. Good. Now try to find the differences to your code, which as I understand your post, does not compile. As

Re: [Rcpp-devel] Rcpp, bigmemory, package creation

2013-04-11 Thread Alex Ustian
Dirk, Sorry to be dense, but you mean to copy and paste the source into an Rmd file and knit it? If yes, then I did just that and it did work. Thanks again, Alex On Thu, Apr 11, 2013 at 3:35 PM, Dirk Eddelbuettel wrote: > > Alex, > > Thanks to Mike, we do have one public, posted, working exa

Re: [Rcpp-devel] Rcpp, bigmemory, package creation

2013-04-11 Thread Dirk Eddelbuettel
Alex, Thanks to Mike, we do have one public, posted, working example of Rcpp and bigmemory in the Rcpp Gallery: http://gallery.rcpp.org/articles/using-bigmemory-with-rcpp/ So before we go any further with this, can you please confirm that you manage to re-build that example (once you grab t

Re: [Rcpp-devel] Rcpp, bigmemory, package creation

2013-04-11 Thread Alex Ustian
Hello again, Thank you for looking over my issue and sorry for not giving reproducible code. I guess assumed that I was doing something obviously wrong but just didn't see it. I did add an entry for bigmemory (and Rcpp) in the DESCRIPTION file for both the Depends and LinkingTo fields. Here is

[Rcpp-devel] Templated function that removes all the NA values

2013-04-11 Thread leo
Hi to all, I was investigating a way to write with Rcpp a function that removes all the NA values in the input vector. And before doing so, I was playing with Rcpp, writing this function: library(inline) cppFunction(' Vector na_test(const Vector& x) { return setdiff(x, Vector::create(::tr