Re: [Rcpp-devel] Comparison of R and rcpp for backsolve

2014-06-27 Thread Colin Rundel
I do believe that arma uses the correct back solve when everything is called correctly (I haven’t profiled the code recently to check what BLAS functions are being called though). I get better performance from Rcpp than R when I change the back solve line to be RI = solve(trimatu(R_upptri),I);

Re: [Rcpp-devel] Comparison of R and rcpp for backsolve

2014-06-27 Thread Dirk Eddelbuettel
Very nice discussion, thanks to all involved. We generally have Conrad's ear for simple-enough changes so if someone wants to help getting the triangular solver access to BLAS into Armadillo we can probably make that happen. Otherwise we can either hit BLAS directly, or use Eigen as Gabor sugges

Re: [Rcpp-devel] Comparison of R and rcpp for backsolve

2014-06-27 Thread Gabor Grothendieck
On Fri, Jun 27, 2014 at 7:14 PM, Peter Rossi wrote: > Folks- > > In my package, bayesm, I use backsolve() to invert upper-triangular > arrays. I am in the process of converting my package to rccp-arma. > > I thought I would test the analogous operation in arma by declaring > the matrix as upper-t

Re: [Rcpp-devel] Comparison of R and rcpp for backsolve

2014-06-27 Thread Matteo Fasiolo
Hi Hao, from what I understand Armadillo doesn't have a forward or back-solver. In any case it's pretty easy to create one, for example you can have a look here: https://github.com/mfasiolo/mvnfast/blob/master/src/mahaCpp.cpp Have a nice weekend, Matteo On Sat, Jun 28, 2014 at 12:25 AM, Hao

Re: [Rcpp-devel] Comparison of R and rcpp for backsolve

2014-06-27 Thread Hao Ye
Hi Peter, I think Soren had a similar issue in February (about Armadillo not having an optimized solver for triangular matrices): http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2014-February/007147.html I don't think there was ever a reply though... In contrast, the notes for backsolve

[Rcpp-devel] Comparison of R and rcpp for backsolve

2014-06-27 Thread Peter Rossi
Folks- In my package, bayesm, I use backsolve() to invert upper-triangular arrays. I am in the process of converting my package to rccp-arma. I thought I would test the analogous operation in arma by declaring the matrix as upper-triangular and inverting using solve(). To my surprise, pure R co

Re: [Rcpp-devel] Returning a matrix from RcppEigen

2014-06-27 Thread Michael Hannon
This may be too-simpleminded for subscribers to this list, but I've posted my two examples to: https://github.com/DavisDaddy/RcppLinAlg -- Mike On Fri, Jun 27, 2014 at 11:38 AM, Kevin Ushey wrote: > Hi Michael, > > Thanks for reporting -- things like this signal that we could do better > er

Re: [Rcpp-devel] Returning a matrix from RcppEigen

2014-06-27 Thread Kevin Ushey
Hi Michael, Thanks for reporting -- things like this signal that we could do better error reporting, e.g. it might be more appropriate to see Error in eval(expr, envir, enclos) (from srcConn#6) : Wrong R type for mapped vector (expected 'double', got 'integer') or something to that effec

Re: [Rcpp-devel] Returning a matrix from RcppEigen

2014-06-27 Thread Michael Hannon
Thanks, Dirk. Last night I woke up with a cramp in my leg and the inspiration that the problem was in the R test code, not in the call to Eigen. I was absent-mindedly creating integer matrices in my test code. After I changed to: amat <- matrix(as.numeric(1:9), nrow=3) etc., the Eigen stuf

[Rcpp-devel] sort() not sorting names

2014-06-27 Thread Sven E. Templer
Hi, sorting an Rcpp Vector leaves it's name attribute unsorted. See this code: require(Rcpp) require(inline) f <- cxxfunction(sig=c(xx="integer"), plugin="Rcpp", body=' IntegerVector x(xx); x.sort(); return x;') x <- c(a=1, b=2, c=0) f(x) sort(x) I would love to have this available, but I am no

Re: [Rcpp-devel] Returning a matrix from RcppEigen

2014-06-27 Thread Dirk Eddelbuettel
On 26 June 2014 at 16:01, Michael Hannon wrote: | Greetings. I've been trying to get familiar with RcppArmadillo and RcppEigen. | As my "Hello, world!" example I'm using matrix multiplication. I got the | Armadillo version to work, but I'm having trouble with the Eigen version. | | I'm trying t