0

I'm trying to use Armadillo for linear algebra calculations on rather large matrices (1500*1125) (representing images, like in Matlab). I've written a code to use Armadillo to calculate the pseudo inverse, but the executable crashes immediately upon starting. I'm using Armadillo 3.920.2 and Visual studio 2010.

This is the code:

// ....declarations of variables, matrices etc. 
// Matrix temp contains the image.
// rows and cols are the x and y size of the image matrix, 
// whose gradient matrices are L_x and L_y. lambda and beta are constants.

L_x=temp.rows(1,rows-1)-temp.rows(2,rows);

L_y=temp.cols(1,cols-1)-temp.cols(2,cols);

L_x=arma::sqrt(arma::pow(L_x,2)+beta*beta);

L_y=arma::sqrt(arma::pow(L_y,2)+beta*beta);

L=-(L_x+L_y);

Alpha=lambda*L;

unsigned int alpha_size_0=Alpha.n_rows;

unsigned int alpha_size_1=Alpha.n_cols;

arma::Mat<unsigned int> I(alpha_size_0,alpha_size_1);

I.eye();

PI=arma::pinv((I+Alpha));

//.....

It's the pinv() which makes the app crash, because when I comment the last line, then there's no problem. I have added Armadillo library, uncommented the use_lapack and use_blas lines in config.h, included the path in the project and copied the .lib files to the folder where the executable is built. The executable doesn't even start, or do the computations which come before this block of code. It just hangs.

  • 1
    Armadillo 3.920 is quite old. Upgrade to the 4.550 series, and a more recent version of MSVC. Since you're doing calculations on large matrices, you should also be using a 64 bit bit operating system (for speed and memory reasons). – mtall Dec 11 '14 at 17:38
  • I remember that happening to me once with Armadillo. I solved it by using a different version of Blas & Lapack (from a different website). I suggest you get them from a different place. – memo1288 Dec 11 '14 at 20:16
  • @mtall I used 3.920 because I was not able to build the latest version using Visual Studio 2010. Since I already have an application framework built using VS2010, it'd be easier for me to use 3.920 rather than updating the whole solution to VS2012 or 13. Also, I do have a 64 bit OS, but the application is being built in Win32 configuration. Do the 4.550 version have a fix for problems like mine? – Surya Rajan Dec 12 '14 at 17:37
  • @memo1288 By different version, do you mean of Armadillo, or did you use Blas and Lapack separately? – Surya Rajan Dec 12 '14 at 17:38
  • @SuryaRajan I mean Blas & Lapack, which I obtained separately. – memo1288 Dec 12 '14 at 20:16

0 Answers0