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:
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).
Using a random matrix without reporting the values of the matrix elements practically ensures that nobody can reproduce your results.
One major problem in your code: you do not seem to realize that random numbers are, if may I say it, random!
Since you make different calls to rand() for generating elements of matrices RL2 and MKL_RL2, you are calling GMM and MKL with different matrices. In this situation, if you obtained identical inverse matrices from MKL and some other package, that would be a miracle, or rand() would have to possess the highly undesirable property of returning numbers in identical pairs!
Use, instead, a well-behaved and well-defined matrix such as (in Matlab notation) A =[2 -1 0; -1 2 -1; 0 -1 2], with inverse [3/4 1/2 1/4; 1/2 1 1/2; 1/4 1/2 3/4]. Report what you get from MKL for the inverse of this matrix with your code.
With such a simple matrix, one can deal with MKL and how to call it correctly, without bringing in yet another package (such as GMM, which I have never used) into the picture.