[Rcpp-devel] failed to compile code on the server with simple operations on matrices with type fmat {RcppArmadillo}

Yue Li gorillayue at gmail.com
Wed Jun 3 15:09:05 CEST 2015


Thanks for looking into it. I will try to get it work on the server.



> On Jun 3, 2015, at 6:42 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> 
> 
> It also works for me on Linux:
> 
> R> sourceCpp("/tmp/yueli.cpp")
> 
> R> set.seed(42)
> 
> R> x <- matrix(rnorm(4),2,2)
> 
> R> y <- matrix(rnorm(4),2,2)
> 
> R> fmatMultiply(x, y)
>          [,1]     [,2]
> [1,]  0.515698  2.03786
> [2,] -0.295452 -0.91346
> R>
> 
> so I strongly suspect that what I just stated is true: it works if R uses an
> external (complete) LAPACK; it fails when R internal's LAPACK is used as
> sgemm is of no interest to R.
> 
> Use mat instead of fmat, or if you insist, rebuild R on the server.
> 
> Dirk
> 
> PS  My version of your file below
> 
> // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
> 
> // we only include RcppArmadillo.h which pulls Rcpp.h in for us
> #include <RcppArmadillo.h>
> 
> // [[Rcpp::depends(RcppArmadillo)]]
> 
> using namespace Rcpp;
> using namespace arma;
> 
> // [[Rcpp::export]]
> fmat fmatMultiply(fmat x, fmat y) {
>        fmat ans = x * y;
> 
>        return ans;
> }
> 
> /*** R
> set.seed(42)
> x <- matrix(rnorm(4),2,2)
> y <- matrix(rnorm(4),2,2)
> fmatMultiply(x, y)
> */
> 
> 
> -- 
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list