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 个)
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!