[Rcpp-devel] failed to compile code on the server with simple operations on matrices with type fmat {RcppArmadillo}
Dirk Eddelbuettel
edd at debian.org
Wed Jun 3 12:42:46 CEST 2015
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