segmentation violation using armadillo pinv() mex file MATLAB 2013a
이전 댓글 표시
Hi everybody, I am having issues using armadillo's pinv(arma::mat m) function in my mex file (created using the legacy code tool). Here is an example of what I'am trying to do
arma::mat unit(2,2);
arma::mat p;
unit.randu();
unit.print();
p = pinv(unit);
p.print();
When I perform the peudo inverse and the assignment I get a segmentation violation error causing matlab to crash. I cannot understand why this is appening. Even because the following code, actually works
arma::mat unit(2,2);
arma::mat p;
unit.randu();
unit.print();
pinv(unit);
But obviously I cannot access to the pseudoinverse. Can anyone help me? Is very important and I cannot find any information on the matter. Thank you very much Andrea
댓글 수: 1
채택된 답변
추가 답변 (1개)
Matthias
2014년 1월 4일
2 개 추천
I have to mention that it is actually not necessary to use the systems "blas+lapack" libraries. For exactly your problem Armadillo offers the define flags "ARMA_BLAS_LONG" and "ARMA_BLAS_LONG_LONG". You can use these flags to define the correct array element sizes that serve as parameters for blas and lapack routines. In my case (also Ubuntu 12.04 64bit) I compile the mex files with "-DARMA_BLAS_LONG" and link them with "-lmwlapack -lmwblas". Afterwards everything works fine.
You may have a look at the "config.hpp" and "typedef_blas_int.hpp" headers of the armadillo library.
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!