Community
cancel
Showing results for 
Search instead for 
Did you mean: 
zhang_j_
Beginner
65 Views

unexpected outputs of lapack_cheev

Hello Guys,.

I am using the LAPACKE_cheev now from MKL. I have written a piece of code with this API. However, its outputs are out of my expectation. The code is attached. 

	lapack_complex_float *a = (lapack_complex_float*)malloc(sizeof(lapack_complex_float)*N*N);
	a[0].imag = 0;
	a[0].real = 0;
	a[1].imag = 1;
	a[1].real = 0;
	a[2].imag = 0;
	a[2].real = 1;
	a[3].imag = 0;
	a[3].real = 0;
	a[4].imag = 0;
	a[4].real = 0;
	a[5].imag = 0;
	a[5].real = 0;

	int matrix_order = LAPACK_ROW_MAJOR; //LAPACK_COL_MAJOR
	const char jobz = 'N';
	const char uplo = 'U';
	lapack_int n = N;
	lapack_int lda = N;
	float *w = (float*)malloc(sizeof(float)*N);

LAPACKE_cheev(matrix_order, jobz, uplo, n, a, lda, w);
	
	for (int i = 0; i < N; i++)
	{
		cout << w << endl;
	}

I expect the outputs as follows:

[-1.414, 0, 1.414]

However, the outputs from my local machine is as follows:

[-4.31602e+008, -1, 1]

Could anybody help me with this issue?

0 Kudos
1 Reply
Zhang_Z_Intel
Employee
65 Views

What is the value of N in your code? The matrix 'a' doesn't look to have a square shape. I believe this is the problem. Take a look at the lapacke_cheev_row.c example in MKL, please. It can be found in the 'examples' folder in your MKL installation.

Reply