-1

I am trying to find the eigenvalues of a square matrix using the function eig_sym from the Armadillo linear algebra library:

mat STRESS = Mat<double>(3, 3, fill::zeros);
vec principals;

/**
   Populate STRESS with symmetric values
   from a stress tensor history named "stressTensor"
**/

STRESS(0,0) = stressTensor[XX].data[0];
STRESS(0,1) = stressTensor[XY].data[0];
STRESS(0,2) = stressTensor[XZ].data[0];
STRESS(1,0) = stressTensor[XY].data[0];
STRESS(1,1) = stressTensor[YY].data[0];
STRESS(1,2) = stressTensor[YZ].data[0];
STRESS(2,0) = stressTensor[XZ].data[0];
STRESS(2,1) = stressTensor[YZ].data[0];
STRESS(2,2) = stressTensor[ZZ].data[0];

eig_sym(principals, STRESS); // Code fails here

I get the std::logic_error message, which according to the Armadillo Doc means that the matrix STRESS is not square, even though it is demonstrably square.

I have even run the example code from the Armadillo Doc:

// for matrices with real elements

mat A = randu<mat>(50,50);
mat B = A.t()*A;  // generate a symmetric matrix

vec eigval;
mat eigvec;

eig_sym(eigval, eigvec, B);

This also produces the std::logic_error message.

I feel like I'm missing something very simple because I can't even get the example code to work. Include directory is set up correctly as I have no issue using arma:: functions elsewhere in my project.

Thanks in advance for the help!

Louis Vallance

EDIT 24/10/14 @1316GMT: I think the error is caused by the fact that I don't have LAPACK configured. I was under the impression that Armadillo comes with LAPACK and openBLAS pre-compiled. How can I configure my project to link with LAPACK if I only installed Armadillo?

1 Answers1

1
  • Change the config file inside armadillo_bits and uncomment the following lines #define ARMA_USE_LAPACK and #define ARMA_USE_BLAS
  • http://ylzhao.blogspot.com.au/2013/10/blas-lapack-precompiled-binaries-for.html this link will help to download the precompiled version of blas and LAPACK libraries download release version 32 bit depending on your mingW bit installation
  • Inside the project place the folder
  • Go to project properties > c++ build > mingw c++ linker > under tool setting set the name of libraries without the lib extension
  • Add the library search path and select from the work space option
  • Place the dll files of those libraries in the project folder

This should be good enough to run

Bowdzone
  • 3,827
  • 11
  • 39
  • 52
Rudraksha
  • 37
  • 4