Sunday 15 July 2012

c++ - Armadillo function eig_sym() not working -



c++ - Armadillo function eig_sym() not working -

i trying find eigenvalues of square matrix using function eig_sym armadillo linear algebra library:

mat stress = mat<double>(3, 3, fill::zeros); vec principals; /** populate stress symmetric values 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 std::logic_error message, according armadillo doc means matrix stress not square, though demonstrably square.

i have run illustration code armadillo doc:

// matrices real elements mat = randu<mat>(50,50); mat b = a.t()*a; // generate symmetric matrix vec eigval; mat eigvec; eig_sym(eigval, eigvec, b);

this produces std::logic_error message.

i sense i'm missing simple because can't illustration code work. include directory set correctly have no issue using arma:: functions elsewhere in project.

thanks in advance help!

louis vallance

edit 24/10/14 @1316gmt: think error caused fact don't have lapack configured. under impression armadillo comes lapack , openblas pre-compiled. how can configure project link lapack if installed armadillo?

change config file within armadillo_bits , uncomment next lines #define arma_use_lapack , #define arma_use_blas http://ylzhao.blogspot.com.au/2013/10/blas-lapack-precompiled-binaries-for.html link help download precompiled version of blas , lapack libraries download release version 32 bit depending on mingw bit installation inside project place folder go project properties > c++ build > mingw c++ linker > under tool setting set name of libraries without lib extension add library search path , select work space option place dll files of libraries in project folder

this should plenty run

c++ armadillo eigenvalue

No comments:

Post a Comment