[Rcpp-devel] RcppArmadillo-based code not finding Lapack routines

Dirk Eddelbuettel edd at debian.org
Mon Sep 27 21:54:13 CEST 2010


On 27 September 2010 at 12:43, Davor Cubranic wrote:
| After I upgraded to RcppArmadillo 0.2.6, running existing code that uses it throws the following error:
| 
| run-time error: eig_sym(): need LAPACK
| 
| Any idea what might be causing this? I'm trying to create a minimal code needed to reproduce the problem, and strangely enough, this works fine:
| 
| eig <- cxxfunction( signature() , '
|       arma::mat x = arma::randu(4, 4);
|       arma::mat X = arma::trans(x)*x;
|       arma::vec v = arma::eig_sym(X);
|       return List::create( 
|         _["X"] = X, 
|         _["eigval"] = v
|     ); 
|     ', plugin = "RcppArmadillo" )


Hm, works here as is:

> eig <- cxxfunction( signature() , '
+       arma::mat x = arma::randu(4, 4);
+       arma::mat X = arma::trans(x)*x;
+       arma::vec v = arma::eig_sym(X);
+       return List::create(
+         _["X"] = X,
+         _["eigval"] = v
+     );
+     ', plugin = "RcppArmadillo" )
Loading required package: Rcpp
> eig()
$X
        [,1]    [,2]    [,3]   [,4]
[1,] 1.16118 0.91138 0.94253 1.4273
[2,] 0.91138 1.46893 1.51221 1.2940
[3,] 0.94253 1.51221 1.64724 1.2622
[4,] 1.42726 1.29396 1.26223 1.8556

$eigval
           [,1]
[1,] 1.7928e-05
[2,] 7.3959e-02
[3,] 8.0209e-01
[4,] 5.2569e+00

> 


Ubuntu 10.4, current Rcpp, current RcppArmadillo.

Does your R have proper LAPACK support?  The way I maintain the Debian /
Ubuntu package, it builds with shared library support and calls out to
external LAPACK anyway.  So in a round-about way, we get 

	 Armadillo -> RcppArmadillo -> Rcpp -> R -> Lapack

but really it is just Rcpp -> R -> Lapack.

Dirk


PS For good measure, I also started a fresh session:

> .help.ESS <- help
> options(STERM='iESS', editor='emacsclient')
> library(inline)
> eig <- cxxfunction( signature() , '
+       arma::mat x = arma::randu(4, 4);
+       arma::mat X = arma::trans(x)*x;
+       arma::vec v = arma::eig_sym(X);
+       return List::create(
+         _["X"] = X,
+         _["eigval"] = v
+     );
+     ', plugin = "RcppArmadillo" )
Loading required package: Rcpp
> eig()
$X
       [,1]   [,2]   [,3]   [,4]
[1,] 2.1209 1.2386 1.3099 2.1985
[2,] 1.2386 1.0866 1.0289 1.5970
[3,] 1.3099 1.0289 1.0200 1.6309
[4,] 2.1985 1.5970 1.6309 2.6648

$eigval
          [,1]
[1,] 0.0010269
[2,] 0.0554859
[3,] 0.3229261
[4,] 6.5128659

> 

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list