Dear all,
I had posted another topic regarding my problem with ?GETRF and ?GETRI and ?GETRS. The problems seemed to be solve, but I still get very strange results, sometimes. The results are totally different from results I get from another library just in order to verify that I am using MKL correctly. I am using Linux, Intel C++ Compiler 11.1 and MKL. The code I used is below:
dense_matrix RL2(nCells, nCells);
double *MKL_RL2;
MKL_RL2=new double[nCells*nCells];
double x=1.0;
for (int i=0; i for (int j=0; j {
RL2(i, j)=x;
MKL_RL2[j*nCells+i]=x;
x+=1.0;
}
try
{
gmm::lu_inverse(RL2);
// MKL solution to perform "RL" matrix inversion
int info;
int ipiv[nCells];
int lwork=-1;
double optwork;
dgetrf(&nCells, &nCells, MKL_RL2, &nCells, ipiv, &info);
dgetri(&nCells, MKL_RL2, &nCells, ipiv, &optwork, &lwork, &info);
double *work;
lwork=(int)optwork;
work=new double[lwork];
dgetri(&nCells, MKL_RL2, &nCells, ipiv, work, &lwork, &info);
delete[] work;
}
catch (dal::failure_error& e)
{
DAL_THROW(failure_error, "Failed to invert RL matrix\\n" << e.what());
}
delete[] MKL_RL2;
As you see, I am comparing "RL2" from GMM++ library with "MKL_RL2" with MKL and as I stated, the results are 100% different. The results from GMM++ are correct (I verified with MATLAB) but MKL, by some reason doesn't work correctly. I have same problem with I use MKL function with complex numbers.
Is there anything wrong with the code that I call MKL functions? First I factorize the matrix, then query to get optimal value for the work space, and the call getri to invert the matrix. This is exactly as MKL example in FORTRAN does (except querying and they used 64*N which I tried also without any success).
I would appreciate your helps.
Regards,
Dan