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?