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.